Performance Mode — Speed Up Your API
Update checks are bursty and repetitive. Every running copy of your app polls the same /checkVersion endpoint with nearly identical parameters, and each call validates the app, channel, platform, and architecture against MongoDB. At a few hundred clients that's fine. At thousands it's the same handful of database queries, repeated thousands of times a minute.
Performance Mode fixes that with caching. This post explains how it works, how to configure Redis, how cache invalidation keeps results correct, and how to stack an optional Nginx microcache on top for a multi-layer strategy.
What is Performance Mode? 🤔
Performance Mode is a Redis-backed caching layer for the API that:
- 🚀 Reduces response times
- 📉 Lowers database load
- 💾 Optimizes resource usage
When enabled, faynoSync caches the result of /checkVersion in Redis and serves repeat requests straight from memory instead of re-querying MongoDB. See the Performance Mode docs for the reference.
How It Works 🛠️
┌─────────────────────────────┐
client ──────▶ │ GET /checkVersion │
└──────────────┬──────────────┘
│
PERFORMANCE_MODE=true?
│
┌──────────────┴──────────────┐
▼ ▼
look up in Redis (disabled) query
│ MongoDB every time
┌────────┴────────┐
▼ ▼
cache HIT cache MISS
return from query MongoDB,
Redis (fast) store in Redis,
then return
- Request arrives — the API checks whether
PERFORMANCE_MODE=true. - Cache check — it looks for cached data in Redis for that request.
- HIT → return immediately.
- MISS → query MongoDB, store the result in Redis, then return.
- Next request — the same query is now a cache hit.
What gets cached?
Performance Mode is currently implemented for the /checkVersion endpoint — by far the most frequently called one, since every client polls it for updates.
Why Do We Need It? 🎯
- Database load reduction — far fewer MongoDB queries for the same repeated update checks.
- Faster response times — cached responses come from memory, no database round-trip.
- Resource optimization — lower CPU and DB pressure means the same hardware scales further.
This matters most exactly when it's hardest: traffic spikes right after you publish a release and every client checks in at once.
How to Enable It 🔌
Enable the mode and point faynoSync at your Redis instance in .env:
PERFORMANCE_MODE=true
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
| Variable | Default | Description |
|---|---|---|
PERFORMANCE_MODE | false | Master switch for Redis caching |
REDIS_HOST | localhost | Redis hostname or IP |
REDIS_PORT | 6379 | Redis port |
REDIS_PASSWORD | (empty) | Leave empty if Redis has no auth |
REDIS_DB | 0 | Redis database number |
That's it — once PERFORMANCE_MODE=true and Redis is reachable, the API starts caching automatically. Full reference in the environment overview.
Cache invalidation — staying correct 🔄
A cache is only useful if it never serves stale "latest version" info. faynoSync handles this for you:
When you upload a new application with
publishset totrue, the Redis keys for that app are removed. The next/checkVersionrequest repopulates the cache with fresh data.
So the moment you publish a release, the old cached answer for that app is gone — the next client to check gets the new version, and everyone after them gets it from cache again. No manual flushing, no risk of pinning users to an old build.
