0

I have multiple services which need Memcached (e.g. "book service", "customer service"). I have two options:

  1. Set up one AWS Elasticache cluster and share it, using a prefix scheme for the keys "book-service-key1", "customer-service-key1" etc.
  2. Set up one cluster per service.

If all services use the same cluster (option 1), will "book service" hold all the Memcached data used by "customer service" in memory, even if it has never used any of these keys?

My question stated in other words: If I start a memcached client and join it to a cluster, will it replicate and hold all the data, or only data which it accesses?

Fletch
  • 4,829
  • 2
  • 41
  • 55
  • I did not get the question that you asked in the end.. Could you please give more details – pratikvasa Nov 28 '20 at 15:16
  • @pratikvasa I tried to clarify it now. – Fletch Nov 30 '20 at 08:06
  • usually a client never holds any data. Its only the server that holds the data. We have a cluster of 6 memcache servers running and about 20 microservices that use all these servers. If you can properly define keys that have no conflict then I think there should be no issue. – pratikvasa Nov 30 '20 at 08:56
  • ahh, thanks. I must have misunderstood how memcached fundamentally works. – Fletch Nov 30 '20 at 13:27

1 Answers1

0

Memcache Client will not hold any data so there should not be an issue of one service holding data from an other service.

Also creating multiple clusters for each service will add to an overhead of maintaining multiple clusters. Also utilisation will be very poor in such a scenario where you would need to keep a buffer for extra objects to be stored.

If you can manage key naming properly where you can avoid conflicts it would be great to have a single cluster of at least 2-3 machines.

One more thing to consider is have smaller instances rather than 2 or 3 huge instances. So that failure of one memcache instance can be absorbed by the DB easily.

pratikvasa
  • 1,897
  • 20
  • 24