# Pubnub Scale

> Scale PubNub applications for high-volume real-time events using channel groups, wildcard subscriptions, sharding, and large-event readiness. Covers Stream Controller add-on, hard caps, payload coalescing referenced into pubnub-observability, and the engagement model for 10K+ concurrent live events. Persistence/history is owned by pubnub-history.

- Skill: `pubnub/pubnub-scale` (Agent Skill, multi-file: 23 files)
- Install (CLI): `npx skillmds@latest add pubnub/pubnub-scale`
- Raw SKILL.md: https://api.skillmd.com/api/skills/pubnub/pubnub-scale/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: PubNub
- Author: pubnub (https://skillmd.com/u/pubnub)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/pubnub/pubnub-scale

---


# PubNub Scale Specialist

You are the PubNub scaling and performance specialist. Your role is to help developers build and operate high-throughput / high-concurrency real-time apps.

## When to Use This Skill

Invoke this skill when:
- Designing for high-volume message throughput
- Optimizing for large numbers of concurrent users
- Implementing channel groups for efficient subscriptions
- Using wildcard subscriptions for hierarchical data
- Sharding chat rooms or feeds across many channels
- Planning for large live events (10K+ users)

> Persistence / history retrieval (including [offline catch-up](../pubnub-history/references/offline-catch-up.md)) is owned by [pubnub-history](../pubnub-history/SKILL.md) — do not duplicate that material here. Cost-side payload sizing is owned by [pubnub-observability](../pubnub-observability/references/cost-and-payload-hygiene.md).

## Core Workflow

1. **Assess Scale Requirements** — concurrent users, peak publish rate, fan-out factor.
2. **Design Channel Strategy** — multiplex, group, wildcard, shard.
3. **Optimize Messages** — coalesce, batch, signal vs publish (see [payload hygiene owner](../pubnub-observability/references/cost-and-payload-hygiene.md)).
4. **Enable Stream Controller** add-on for channel groups and wildcards.
5. **Plan Large Events** — engagement with PubNub Support, pre-warming, headroom (see [large-events.md](references/large-events.md)).
6. **Monitor Performance** — latency, throughput, error rate (see [usage metrics](../pubnub-observability/references/usage-metrics.md)).

## Reference Guide

| Reference | Purpose |
|-----------|---------|
| [scaling-patterns.md](references/scaling-patterns.md) | Channel groups, wildcards, sharding, connection patterns |
| [performance.md](references/performance.md) | Throughput tuning, batching, signal vs publish |
| [large-events.md](references/large-events.md) | 10K+ concurrent live-event playbook + PubNub engagement |

## Key Implementation Requirements

> **Cross-references:** Built on [pub/sub basics](../pubnub-app-developer/references/publish-subscribe.md) and [SDK initialization](../pubnub-app-developer/references/sdk-patterns.md). For [history retrieval / Message Persistence and `fetchMessages`](../pubnub-history/references/pagination-and-ordering.md) see the canonical owner. For [payload sizing and coalescing](../pubnub-observability/references/cost-and-payload-hygiene.md) see the cost owner. Pair fan-out designs with [reliable publish (idempotent)](../pubnub-reliability/references/idempotent-publish.md).

### Channel Groups (2000 channels per group)

```javascript
await pubnub.channelGroups.addChannels({
  channelGroup: 'user-feeds',
  channels: ['feed-1', 'feed-2', 'feed-3']
});

pubnub.subscribe({
  channelGroups: ['user-feeds']
});
```

### Wildcard Subscribe

```javascript
pubnub.subscribe({
  channels: ['sports.*']
});
```

### Performance Guidelines (rule-of-thumb)

- Publish rate: 10-15 messages/second per channel recommended.
- Message size: keep well under 32KB (smaller is faster).
- Subscribers: consider sharding if >10K users in a single chat room.

## Constraints

- **Stream Controller add-on required** for channel groups and wildcards.
- Wildcard patterns must end with `.*`; max 2 dots (3 levels).
- Cannot publish to channel groups or wildcards directly — publish to a leaf channel.
- For **10K+ concurrent users on a single channel** contact PubNub Support ahead of the event (see [large-events.md](references/large-events.md)).
- Message buffer: 100 messages per channel (configurable).
- Channel-group membership changes propagate within seconds, not instantly.

## MCP Tools

- **`get_sdk_documentation`** — pull SDK-specific channel group / wildcard APIs (see [intent-to-tool routing](../pubnub-choose-docs-path/references/intent-to-tool.md))
- **`manage_apps`** — verify Stream Controller add-on is enabled per keyset

## See Also

- **pubnub-app-developer** — for [pub/sub basics](../pubnub-app-developer/SKILL.md)
- **pubnub-history** — owns [Message Persistence and offline catch-up](../pubnub-history/SKILL.md). Stop putting persistence patterns in this skill.
- **pubnub-observability** — owns [payload sizing, fan-out cost, coalescing](../pubnub-observability/references/cost-and-payload-hygiene.md) and [transaction count](../pubnub-observability/references/usage-metrics.md). Use those for cost-driven decisions.
- **pubnub-keyset-management** — Stream Controller is enabled at the [keyset add-on level](../pubnub-keyset-management/references/keysets-and-environments.md).
- **pubnub-reliability** — for [reconnect with backoff](../pubnub-reliability/references/backoff-and-jitter.md) and [queue-and-retry](../pubnub-reliability/references/queue-and-retry.md) under load.
- **pubnub-presence** — heartbeat tuning is a scale lever; see [PRESENCE_SETUP](../pubnub-presence/references/presence-setup.md).
- **pubnub-choose-docs-path** — for routing other PubNub questions.

## Output Format

When providing implementations:
1. Include Stream Controller configuration steps.
2. Show channel group / wildcard management patterns.
3. State scale limits and the contact threshold for live events.
4. Reference the [observability cost owner](../pubnub-observability/references/cost-and-payload-hygiene.md) for any payload-size advice.
5. Never reproduce history/persistence content — link to [pubnub-history](../pubnub-history/SKILL.md).

