How Gogoduk Boosts API Performance and Simplifies Architecture with Redis 8.8
A production case study on how Gogoduk leverages Redis 8.8 to optimize API latency and reduce architectural complexity: replacing custom Lua rate limiters with INCREX and optimizing cache invalidation.
Serving millions of geocoding, reverse geocoding, and address autocomplete requests daily in Vietnam with sub-15ms response times requires continuous optimization of Gogoduk's storage and caching layer.
Following the official launch of Redis 8.8 in early June 2026, the engineering team at Gogoduk quickly began testing and integrating this release in our staging environment to prepare for production upgrades.
This article shares a real-world case study of how Gogoduk leverages the groundbreaking features of Redis 8.8 to accelerate API responses and simplify distributed systems.
1. Replacing Lua Scripts with Native API Gateway Rate Limiting
The Legacy Rate Limiting Setup
Before version 8.8, to guarantee atomic rate limiting and prevent memory leaks due to sudden network failures, Gogoduk used a custom Lua script to execute INCR and EXPIRE atomically on Redis:
While functional, this approach introduced minor architectural headaches:
- The Go middleware code had to manage, load, and cache Lua script SHA hashes.
- The Redis server had to run the Lua VM virtual machine, consuming CPU cycles under massive traffic spikes.
The Upgraded Solution with Native INCREX
Redis 8.8 solves this by providing the native INCREX command built directly into its core:
We rewrote our Go rate limiter middleware to use the command directly:
Measured Benefits:
- 50% Cleaner Code: Eliminated Lua script declarations and execution error management in the Go codebase.
- Reduced Redis CPU: CPU usage on the Redis cluster for rate limiting fell by approximately 12% during peak traffic since the Lua VM is no longer needed.
- Minimal Latency: The application makes a single native command call to Redis to fetch rate limit status.
2. Granular API Key Caching via Hash Subkey Notifications
A major task of our API Gateway is validating incoming API keys (Keystore). Gogoduk caches user API keys inside a Hash structure:
The Old Cache Invalidation Limitation
Previously, Redis's Keyspace Notifications only informed the application when the entire hash key user:100 was updated or deleted. If a single API key was revoked, the API Gateway had to invalidate the entire user session cache or poll the database.
The Redis 8.8 Solution
The new Subkey Notifications feature in Redis 8.8 allows applications to subscribe to events for individual fields inside a Hash.
Gogoduk leverages this to listen to changes on specific API keys:
When a user's specific API key is deactivated in the portal, Redis triggers an event, and the Go application immediately invalidates that key from the local memory of the Gateway instances. Other keys belonging to the same user remain cached, avoiding cache churn and database overhead.
3. Optimizing Administrative Boundary Caching with Arrays
Vietnam's administrative boundary maps contain highly detailed polygons. During reverse geocoding, our service retrieves raw coordinate arrays to calculate distances and determine administrative regions.
Storing these large coordinate arrays in Redis using List structures resulted in slow index access speeds, as List is a doubly linked list ($O(N)$ lookup time).
How antirez's Array Type Helps
The new Array structure in Redis 8.8 (designed by Salvatore Sanfilippo) provides $O(1)$ constant-time access by index and stores sparse arrays efficiently in 4,096-slot chunks.
Gogoduk applies this type to cache boundary coordinates. Combined with the ARRING circular buffer and AROP server-side aggregators, Gogoduk reduced the RAM footprint of cached boundary geometries by 30% while accelerating spatial calculations.
4. Conclusion
Testing and implementing new features like Redis 8.8 underscores Gogoduk's commitment to delivering the fastest Vietnam Map API for developers.
By optimizing our gateways, removing Lua VM scripting overhead, and utilizing sparse-friendly arrays, Gogoduk ensures that our API endpoints respond in under 15ms, even during peak shopping and shipping periods.
Ready to integrate fast, reliable address autocomplete for Vietnam? Try the Gogoduk Map API today.
Want to use GoGoDuk?
Free forever — 100 requests/day per account, no credit card. Higher limits on request.
Sign up →