Skip to main content

Event preparation guidelines

Overview

This page offers developers some practical guidelines to prepare their systems for large-scale events, such as NFT mints or token airdrops, ensuring a positive experience for participants by maintaining scalability and system availability.

Core principles for event preparation

Testing strategies

  • Calls to partner APIs: Focus on connection, authentication, error handling, data validation, and synchronization. Simulate high-load scenarios to assess your system’s capacity and response times.
  • On-chain interaction: Use the Saigon testnet to conduct minting simulations and on-chain load tests, leveraging Web3 libraries such as Ether.js and Web3.js.
  • Bot and attack prevention: Implement measures such as social login verification, smart contract (SC) signatures, rate limiting, Cloudflare protection, and CAPTCHAs to distinguish between human users and bots. This involves setting rate limits to ensure that one IP cannot make more than 5-10 requests per second or 60 requests per minute and considering the use of Cloudflare for additional protection.
  • Handling high traffic: Stress-test your infrastructure using Locust for API stress testing and the Saigon testnet with Web3 libraries (Ether.js, Web3.js) for on-chain interactions. Be mindful of the rate limits of external services such as RPC and the Twitter API and ensure backend scalability to manage traffic surges.

Scalability tactics

  • DNS and static caching (CDN): Use DNS/CDN tools such as Akamai, Cloudflare, Route53, and Cloudfront for caching static content, optimizing load times for client-side rendered applications built with frameworks like Next.js or React.
  • Backend applications: Use autoscaling with VMs or container orchestration platforms such as Kubernetes or Nomad, supported by cloud providers like AWS, Azure, GCP, and DigitalOcean. Use Packer to create identical machine images for multiple platforms from a single source configuration, ensuring consistency and efficiency in your deployment process. For single VM backends, consider using PM2 for spawning multiple processing instances or Docker for containerization. Additionally, integrate Docker with Nginx for load balancing and use Consul and Consul-template for automatic service discovery and configuration, ensuring good scalability.
  • Database management: Choose scalable RDBMS solutions like AWS Aurora or GCP Cloud SQL, using caching with Redis for temporary data. Optimize queries for performance by ensuring they read from an index; defaulting to a B-Tree index is usually adequate for most cases. Consider read/write separation to distribute loads efficiently.

Reliability and DDoS mitigation

Use CAPTCHA as a straightforward measure to control user access rates during high load or DDoS attacks, leveraging capabilities from Akamai and Cloudflare to mitigate excessive server access.

In the face of high load or DDoS attacks, CAPTCHA can serve as a simple yet effective tool to regulate user access rates. Both Akamai and Cloudflare offer CAPTCHA functionalities to mitigate excessive server access.

Performance monitoring and insights

Use short-term monitoring solutions from cloud services for system performance insights, including slow query detection and API endpoint analysis. Integrate tools such as Sentry for real-time monitoring and troubleshooting.

Load testing framework

  1. Gather requirements: Define the critical functionalities and user experiences for testing.
  2. Map user journeys: Use monitoring data to simulate realistic user interactions.
  3. Establish a baseline: Conduct initial tests to set performance benchmarks. Whenever performance deviates from this benchmark, you'll know a deeper dive into test data is necessary.
  4. Automate testing Integrate load testing into your CI/CD pipeline. Use tools such as Locust or K6 to simulate user behavior.

Best practices for load testing

  • Create test scenarios that accurately reflect user behavior, targeting the application's critical functions.
  • Predict traffic volumes and patterns using historical data and marketing projections, focusing on APIs expected to experience the highest load.
  • Choose the right testing tools, such as Locust for API testing and Saigon testnet with Ether.js or Web3.js for on-chain testing, based on your specific needs.
info

Example: The Wild Forest Packs sale event experienced nearly 200 requests per second at peak traffic.

Pre-event scalability checklist

  • Predict event-specific traffic and adjust your infrastructure resources in advance.
  • Pre-scale VMs or Kubernetes clusters before the event and scale down afterwards.
  • Increase the CPU and disk IO size of the database and consider switching to high IOPS disks, such as AWS's NVMe or GCP's local SSDs.
  • Increase the number of connections from the API to the database.

Summary

Preparing your system for high-load events involves a strategic approach to testing, scalability, and reliability. By focusing on realistic load simulations, scalable infrastructure, and robust monitoring, you can ensure a seamless experience for users during critical events. This guide outlines essential strategies and best practices, emphasizing the importance of advance preparation and continuous performance optimization.

Was this page helpful?
Happy React is loading...