We have some super heavy APIs, say /api/heavy
, it will slow down our system when peak time, we did some benchmark, if the simultaneous request count is greater than 200, the system becomes slow, and if greater than 600, our system becomes unavailable.
We are unable to add redis
or memcached
layer right now, because it needs to update the source code which is not possible right now for some contract problem.
So we are thinking to put some cache server in front of our API server, and cache these APIs for 10 seconds when the request rate > 500 and 3 seconds when the rate > 150.
How can we do this using Nginx
or Varnish
? Or other solutions? CDN?