I was curious... are there any pro/cons of using compression in memcache?
3 Answers
Many clients do compression, but no compression happens in the server itself.
Client-side compression means less data is sent over the network, but more importantly, individual objects are smaller. Smaller objects will likely be stored more efficiently as they are more likely to fall into smaller slabs.
Even if you don't see significant reduction in slab overhead waste, you should likely have more space available for more objects.

- 89,080
- 21
- 111
- 133
-
4There will be a bit of CPU overhead. If you can measure it, you can adjust your compression algorithm accordingly. :) – Dustin Nov 27 '09 at 18:14
In a large scale cluster, I/O becomes critical.
Compression may increase cpu load but reduce i/o instead.

- 183
- 7
I wasn't aware of compression options in Memcache clients.
However, I think that if you need more space on the Memcache server, you should invest in more ram or possibly more servers if need be. Compressing data will cost CPU cycles on your webserver (depending on the algorithm and degree of compression), and basically I don't think it's worth it.
BTW, Ram is cheapish (note this was written in 2009) :)

- 2,676
- 3
- 25
- 29
-
1If the cache is running on a dedicated machine, it would almost certainly have plenty of unutilized processing power, so CPU hit is unnoticeable. BTW, I've been using AWS and GCP for some time and can't agree that RAM is cheap in general, and also it's cheaper to double number of cores than to double amount of RAM. – user2417480 Apr 29 '16 at 13:46
-
Ok, that depends on your setup of course. RAM was probably less expensive 6-7 years ago than it is today :) – Sune Rievers Apr 29 '16 at 13:50
-
2
-
1