CDP:Cache Proxy Pattern
Problem to Be Solved
When you use multiple web/AP servers as a way to handle high loads, it multiplies the expense. If your budget is tight, you need to think about techniques that will not increase the numbers of web/AP servers.
Explanation of the Cloud Solution/Pattern
One way to increase the performance of a web system is to cache your content. This is a technique where static content or dynamic content that does not change (much) is cached upstream of the web/AP server and that content is delivered by the upstream cache server, which has high delivery performance, until the cache expires. You can construct virtual servers easily in the AWS Cloud, enabling you to implement cache servers easily into your system.
On an EC2 instance, install a common cache server software, such as Varnish, and use it as a cache server.
- Place the cache server software, such as Varnish, in front of the web/AP server.
- Place the cache server in front of the web/AP server.
- In the cache server, set up the server to host the original data, the cache expiration, and the like.
- This lets you deliver content using the cache, without modifying the web/AP servers.
- For dynamic content in particular, this greatly reduces the load of content generation.
- You can set up a flexible cache by either caching or not caching HTTP headers, URLs, cookies, and the like.
- You need to ensure redundancy in the cache server as well so as to not create a single point of failure (SPOF).
- Because the EC2 instance that is used as the web/AP server is located indirectly in Elastic Load Balancing (ELB), you need to be clever in in how you attach to the cache server when the number of web/AP servers has been increased or decreased through Auto Scaling.