We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Caching Strategies
Free preview: the first 2 parts of this 10-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Caching Strategies
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Varnish put the cache in front of the application. Hazelcast puts it inside: every application process is a member of the cluster, and the map lives across all of them. There is no cache server to run.
The sentence everybody repeats about this is that the cache is in the same process, so a read is a memory read. That sentence is true for one key in every N.

Four real member processes, a map partitioned across them by key hash, and 8,000 real reads sent to one of them. 25.9 percent were answered locally, which is one in four because there are four members.
Read the word embedded as being about the deployment, not the access path. There is no separate cache server, and there is still a network hop for every key this particular process does not happen to own.

Hazelcast hashes the key into one of 271 partitions and assigns partitions to members. A get on a member that does not own the partition is forwarded to the one that does.

Every number here is a real socket round trip between real processes. The counts and shares are exact and the latencies are a floor, because loopback removes the network.

A local read is a dictionary lookup. A forwarded read is a socket round trip to another process, and on a real network that is a real network hop, not a loopback one.
These numbers are a floor, and the ratio is what transfers. Loopback removes the network from the forwarded case, so on real hardware the gap between the two bars is wider than this, not narrower.