SKILL.md
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
- Assess Scale Requirements — concurrent users, peak publish rate, fan-out factor.
- Design Channel Strategy — multiplex, group, wildcard, shard.
- Optimize Messages — coalesce, batch, signal vs publish (see [payload hygiene owner](../pubnub-observability/references/cost-and-payload-hygiene.md)).
- Enable Stream Controller add-on for channel groups and wildcards.
- Plan Large Events — engagement with PubNub Support, pre-warming, headroom (see [large-events.md](references/large-events.md)).
- 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)
await pubnub.channelGroups.addChannels({
channelGroup: 'user-feeds',
channels: ['feed-1', 'feed-2', 'feed-3']
});
pubnub.subscribe({
channelGroups: ['user-feeds']
});
Wildcard Subscribe
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
getsdkdocumentation — 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:
- Include Stream Controller configuration steps.
- Show channel group / wildcard management patterns.
- State scale limits and the contact threshold for live events.
- Reference the [observability cost owner](../pubnub-observability/references/cost-and-payload-hygiene.md) for any payload-size advice.
- Never reproduce history/persistence content — link to [pubnub-history](../pubnub-history/SKILL.md).