Why is cache_render very big? I am having a big problem with a newly created Drupal 8 site for a theater.

After going live we discovered that the cache_render table grown extremely big, and extremely fast. After one weekend, it was already over 30 GB which makes a backup of the database impossible.

After some analysis and google search, I have stumbled upon cache_render database table growing in size. They say it is wise to use a caching service such as Memcache but honestly, that does not really solve the problem at all.

I have set the Cache maximum age to 1 hour and the cache_render page STILL sets the expiration date to infinity! Why?

What causes Drupal to fill up the database this much?

System information

Drupal version: 8.1.0

Modules in use:


List item
color_field 8.x-2.0-rc1
contact_block 8.x-1.1
contact_storage 8.x-1.0-beta4
ds 8.x-2.3
embed 8.x-1.0-rc2
entity_embed 8.x-1.0-alpha1
entity_reference_revisions 8.x-1.0-rc6
field_group 8.x-1.0-rc4
file_entity 8.x-2.x-dev (2016-Apr-13)Aktuell  Ok
Google Analytics 8.x-2.0
google_map_field 8.x-1.1
imagemagick 8.x-1.0-alpha2
layout_plugin 8.x-1.0-alpha22
mailchimp 8.x-1.1
menu_link_attributes 8.x-1.0-beta1+5-dev (2016-Feb-23)
metatag 8.x-1.0-beta8
paragraphs 8.x-1.0-rc4
smtp 8.x-1.0-alpha0
token 8.x-1.0-alpha2
weight 8.x-3.0
yoast_seo 8.x-1.0-alpha2+2-dev (2016-Mai-20)
It seems like this could be related to particular blocks or other renderable objects on your site that may have many permutations. In one case, I saw 100,000+ rows for one particular views exposed filter block.

Since users were able to select many different options, the block was stored hundreds of times per page/URL in the cache_render table.

It's best to try to scan through the cid values of the table and see any patterns, e.g. with SELECT COUNT(*) FROM cache_render WHERE cid LIKE "%interesting_cid_here%";, to see if there are any major offenders.

Still trying to figure out the best way (besides periodically running drush cr) to fix this issue. For now, I opened up an issue in the Drupal Core issue queue: cache_render table becomes extremely large over time

See discussion around this issue in this Drupal Core issue: Make CACHE_PERMANENT configurable in the database cache — currently allows unlimited growth: cache DB tables of gigabytes!.