Previous | Next --- Slide 43 of 58
Back to Lecture Thumbnails
yuel1

I'm a little confused here. Why would adding a Front-End Cache be a good idea when the Load Balancer has the liberty to assign requests to any Web Server?

Kapteyn

@yuel1 In assignment 4 we used a front-end cache for compute primes requests. This allowed the master to bypass sending compute prime requests to the worker nodes if the result for that request was already stored in the table you maintained in the master node of previous compute primes results.

yuel1

@Kapteyn That's a good point, but the problem is in our code for assignment 4, the front-end cache lived in the load balancer rather than in between the load balancer and the web server

Kapteyn

@yuel1 I'm not sure I understand your question, perhaps you could reiterate?

Using a front-end cache is an abstraction. Where you chose to put it in your implementation is irrelevant to the usefulness of having a front-end cache. It could go in your load balancer or live on a machine outside of your load balancer.

Having a front-end cache simply means that there's an intermediate layer of service between the load balancer and the actual worker nodes that allows you to get the responses you need without having to make any resource demands on your worker nodes.

Contrastingly, back-end caches like memcached are accessed through the worker nodes. The load balancer sends the request to the worker node, and it is the worker node's job to determine whether or not it can get the data it needs from the back-end cache or if it needs to query the database.

I would guess that front-end caches would be useful for storing generic data that gets requested very frequently and perhaps is unrelated to your database information.

Facebook probably doesn't handle requests this way, but consider this concocted example:
Say you're a facebook load balancer and you get a request for the css file for the newsfeed page. You don't need to bother your worker nodes to service this request. Since all users have the same newsfeed page, you could store the css file in a front-end cache. Same goes for all the little icon images on the newsfeed page.

Contrastingly, you probably wouldn't want to cache the contents of an individual's newsfeed page in the front-end cache. That would be better suited to being stored in memcached.