We are building a website with over a million nodes. Those nodes also have paragraphs which increases the number of entities. Therefore, the cache tables are getting bigger and bigger, especially the cache_entity and cache_render tables.

What is the best way to avoid the database to get too big (we're talking hundred of gigabytes) ? Is memcache a solution here or is it just deporting the problem of disk space ?

The basic cron task doesn't clear the tables. We were also thinking about setting a cron task to execute "drush cr".

According to that post and that issue, Drupal 8.4 will have a better cache table management.

  • Yes, just wanted to comment what you've added to the answer. See also the change record drupal.org/node/2891281. Your cache strategy depends on how many nodes you want to serve from the cache, what we don't know. – 4k4 Nov 13 '17 at 8:50
  • Alright, so that would solve my db size problem but then I should think about what page I want to serve from the cache. We were thinking about that because a lot of content are considered as "archives" so less important. – pbonnefoi Nov 13 '17 at 8:55
  • Then this depends on the more important ones. If you can afford to cache them in memory, then go for Memcached or Redis. – 4k4 Nov 13 '17 at 9:01
  • Alright thank you, I'll look into Memcache or Redis. Any preference on your side ? – pbonnefoi Nov 13 '17 at 9:14
  • In D8 Redis has picked up quite some momentum, see drupal.org/project/usage/redis – 4k4 Nov 13 '17 at 9:23

Part of the solution could be to compress those cache tables where the typical values to cache are quite big and allow for a high compress ratio. I think render caches fit that description very well.

See e.g. issue [#1281408] and a comment on another issue mentioned in comment #23.

Not the answer you're looking for? Browse other questions tagged or ask your own question.