The Proxy lesson opens with an online shop whose Postgres database was close to melting. The same product catalog query ran 50,000 times per minute, though the catalog changed about once a day. Every page load went to the database fresh.
The team put a caching proxy in front of the database. It kept the same method, getProducts(). But it checked a Redis cache first. On a hit it returned the cached result. On a miss it queried Postgres, stored the result for 60 seconds, and returned it. In the lesson's telling, database CPU fell from 98 percent to 12 percent.
The callers did not change at all. That is the point of a proxy. It has the same interface as the real object, so the client cannot tell the difference. An interface here means the list of methods an object offers.
The lesson names five flavors of proxy, all with the same shape:
- Caching proxy: stores results and returns them for repeated requests, like a CDN or an Nginx cache.
- Protection proxy: checks permissions before the call goes through, like an API gateway auth check.
- Virtual proxy: delays building an expensive object until it is really needed, like a lazy-loaded image.
- Logging proxy: records every call for debugging or auditing, like Envoy access logs.
- Remote proxy: stands in for an object in another process or machine, like a gRPC stub.