@pubnub/mcp
Version:
PubNub Model Context Protocol MCP Server for Cursor and Claude
51 lines (40 loc) • 4.27 kB
Markdown
# How to Handle Large-Scale Events with PubNub
PubNub is well-suited for powering real-time features in large-scale events, such as virtual conferences, live sports broadcasts, massive multiplayer games, and fan engagement applications.
## PubNub's Suitability for Large Events
* **High Concurrency Support:** PubNub is designed to handle millions of concurrent users and connections globally.
* **Scalable Infrastructure:** The platform automatically scales to manage traffic spikes, which are common during live events.
* **Low Latency Delivery:** PubNub aims for sub-100ms message delivery, crucial for real-time interactions like live polling, Q&A, and chat during events.
* **Global Reach:** With 15+ Points of Presence (PoPs), PubNub can serve a geographically distributed audience with optimized performance.
* **Proven Use Cases:** PubNub has been used for massive events, including Super Bowl apps and professional sports fan engagement.
## Key Steps and Considerations
1. **Inform PubNub (Virtual Event Form):**
* If your event is expected to gather **more than 10,000 concurrent users**, you **must** inform PubNub by filling out the **Virtual Event Form**.
* **Lead Time:** Submit this form at least **10 days before the event**.
* This generates a support ticket, allowing PubNub to prepare and communicate with you to ensure smooth operation.
* You can find this form or information on how to access it by contacting PubNub Support.
2. **Live Support Options:**
* **Platinum Support Plan:** This plan often includes a set number of hours for live event support (e.g., 5 hours per month, no rollover). You can opt-in to use these hours when filling out the Virtual Event Form.
* **Virtual Events Package:** You can purchase a separate Virtual Events Package for live support, even without a full support plan.
* Contact [support@pubnub.com](mailto:support@pubnub.com) for details on these options.
3. **Architectural Best Practices for Scale:**
* **Efficient Channel Design:**
* Use a minimal number of channels for broad announcements if possible.
* For interactive features like chat, consider sharding users into multiple channels if a single channel exceeds optimal user counts (e.g., >10,000 users in a chat room for best performance).
* Leverage Channel Groups and Wildcard Subscriptions for efficient management of user subscriptions.
* **Message Optimization:**
* Keep message payloads small and concise.
* Use batching for publishing high volumes of non-critical updates if appropriate.
* **Presence Management:**
* Be mindful of presence event volume in channels with extremely high occupancy if detailed presence is enabled for all users. Consider summarizing presence information or using it selectively.
* **Access Control:** Implement PubNub Access Manager (PAM) to secure your channels, especially for events with public participation.
* **Client-Side Performance:** Ensure client applications are optimized to handle incoming messages efficiently without UI freezes, especially on lower-end devices.
4. **Testing and Monitoring:**
* **Load Testing:** If feasible, conduct load tests to simulate event conditions and identify potential bottlenecks in your application logic or infrastructure interacting with PubNub.
* **Latency Monitoring:** Use PubNub's Speed-o-Meter, Status Page, and SDK-based latency metrics to monitor performance before and during the event.
* **Error Handling:** Implement robust error handling and retry mechanisms in your application.
5. **Feature Usage:**
* **Publish/Subscribe:** The core for broadcasting announcements, live updates, poll results, etc.
* **Chat:** Enable audience interaction, Q&A sessions.
* **Presence:** Show live audience counts or facilitate smaller group interactions.
* **PubNub Functions:** Execute serverless logic at the edge for tasks like live moderation, data aggregation, or triggering alerts without managing your own backend servers.
* **Message Persistence (History):** Useful for retrieving key announcements or chat highlights after the event or for users joining late.