PRESENTED BY
How Redis Powers Next-gen of API
Platform at millions RPS scale
Guanlan Dai
Kong Inc, Engineering Manager
Guanlan Dai
■ Leading the Kong Core, Cloud, and AI/ML teams
■ OpenResty Contributor
■ Previously Tech Lead @ Cloudflare
WHO AM I?
Kong - the Most Popular Open-source
Microservices API Platform
● Open-Source
● 45M+ Downloads since 2015
● 20,000+ Stars in GitHub
Millions of Community downloads
across multiple platforms.
● 140+ Contributors
● 110 Meetups
● 10K+ Community Members
Service Control Platform
Monolith Services
Microservices/
Service Mesh
Serverless/
FaaS
Emerging
Patterns
Rate limiting with Redis
Global Rate Limiting
Rate Limiting Tricks
Sliding window
In-memory table
Set-then-get
Redis Sentinel
Caching with Redis
Efficient Caching in Multiple Layers
Worker 2Worker 1
Shared_dict
Lua LRU Cache
I/O Callback on
cache miss
Cluster
Lua LRU Cache
Mutex
Caching Tricks
Layered caching
Smaller objects (<100kb)
Set TTLs
Keyspace Design
Twemproxy
OpenResty with Redis
Non-blocking way using Redis
without the callback hell
Too good to be true?
cosocket = coroutine + socket
Lua Runtime
Redis:set()
Redis:get()
yield
resume
Add NGINX
Events
New Event
Sockets ready to r/w
Errors
Timeouts
Essential Syntax
OpenResty Redis Libraries
● https://github.com/openresty/lua-resty-redis
● https://github.com/openresty/lua-resty-limit-traffic
Benchmark
https://gigaom.com/report/api-management-benchmark/
Thank you!
PRESENTED BY

How Redis powers next-gen of API platform at millions RPS scale