Performance Guidelines
To ensure the best possible experience for players, minimizing latency and ensuring system stability is crucial. Below are the recommended high-performance patterns and architectural best practices for integrating with GPAS.
1. In-Memory Caching Strategy
Section titled “1. In-Memory Caching Strategy”Recommendation: Avoid database hits for every request.
Validating sessions or querying static data by hitting the primary database (e.g., SQL) on every transaction adds significant latency. We strongly recommend implementing an in-memory caching layer (such as Redis or Memcached) to handle:
- Session Validation: Validate the
AuthTokenandwalletSessionIdagainst cache. - Static Data: Cache game lists, currency configurations, and provider settings.
This approach significantly reduces I/O wait times and protects your primary database from high load spikes.
2. Infrastructure & Resources
Section titled “2. Infrastructure & Resources”Recommendation: Use dedicated resources and minimize “Cold Starts”.
Dedicated Resources
Section titled “Dedicated Resources”Where possible, use servers with dedicated resources rather than shared hosting environments. This ensures stable CPU performance and avoids latency spikes caused by “noisy neighbors” in shared environments.
”Cold Start” Optimization
Section titled “”Cold Start” Optimization”If using Serverless architectures (e.g., AWS Lambda, Azure Functions, Google Cloud Functions):
- It is crucial to minimize initialization overhead.
- Keep processes “warm” (Provisioned Concurrency) to avoid the 2-3 second delay of a full stack boot-up on the first request.
3. Simplified & Asynchronous Logic
Section titled “3. Simplified & Asynchronous Logic”Recommendation: Keep the critical path clean.
The logic within the transactional endpoints (Debit, Credit, Rollback) should be as simple and fast as possible. Auxiliary tasks should not block the response to the player:
- Async Logging: Write logs to disk or external services asynchronously.
- Async Metrics: Collect APM (Application Performance Monitoring) metrics in the background.
- Fire-and-Forget: Any task not strictly required to validate the balance or perform the transaction should be offloaded.
4. Transport Protocol
Section titled “4. Transport Protocol”Recommendation: Enable HTTP/2.
If your infrastructure supports it, enabling HTTP/2 greatly improves efficiency in handling concurrent connections compared to HTTP/1.1, reducing overhead and latency under high load.