Nikhilesh A S
Nikhilesh A S

Reputation: 179

Cache using Nginx vs Redis, Proxy and Load balancing using Nginx

I am interested in widening my knowledge in designing large scale distributed systems. I have come across the topics Cache and Proxy servers. For Proxy servers we are using Nginx for example, and Nginx also has it's own Cache. Now, what is the major difference between the cache inside Nginx and Redis ? Particularly I read many articles regarding Proxy servers. I am not completely getting the point of these proxy servers. Some articles do mention that load balancers, proxy and cache are done in Nginx itself, and some have separate servers for each. Could any one please elaborate these in a better way ? Thanks in advance.

Upvotes: 2

Views: 1757

Answers (1)

cppNoob
cppNoob

Reputation: 432

They each serve their own purpose. NGINX could cache the static assets you have deployed and also responses from the backend servers depending on their cache-control settings. This would be useful for data that is being repeatedly downloaded, JS/HTML/image files, etc. It could also cache the HTTP response for identical requests that it receives.

However, in your application, you may decide that some data is is expensive to compute on-the-fly or will be repeatedly requested, so you decide to cache this data in Redis. This could be any data you choose, and not necessarily the entire API response for an HTTP request but even intermediary data where you don't want to hit your database but rather return results from your cache.

Upvotes: 3

Related Questions