I have been tuning cache settings for a large site. I updated memcahed settings and set cache_form to be stored in the Database, cache_form started growing and the amount of transactions along with mysql bin logs, and replicator logs started to eat disk space enormously (I have a database about that is ~ 300GB ). Also, the cron is running fine. So I switched back to Memcache. I need to understand what happens when I have cache forms in a volatile cache?
Also, If this is not an ideal solution, what could I do?
2 Answers
Memcache will drop cache content to make room for new cache objects.
That may be a problem if using a single memcache server instance for several cache bins.
cache_form
needs to be more persistent to avoid losing form build validation data.
You could have a dedicated memcache server instance/port for cache_form
and that would work ok, provided the service isn't restarted. However, in practice, servers need occasional reboot which could cause loss of user form data.
Usually cache_form
is stored in the database as it provides the semi-persistent storage required there.
If cache_form
isn't working properly, your users will experience "This form has been outdated" and other form validation errors.
-
Drupal's cache_form has 6 hour expiration (hard coded in core) if that gives you any idea about how persistent it should be. I've definitely experienced unintended behavior, and failed registrations from putting form cache in memory. Mar 7, 2014 at 7:15
Usually, you can store cache safely in Memcache.
If memcache has enough memory to work with, it should work much faster and it should be reliable enough for production sites (I have deployed memcache many times before).
Since form cache is always temporary and it is required for multistep forms, ajax forms, etc to work, it is possible that if any data gets corrupted in-between actions your users may experience loss of data on the forms they are filling.
I have never seen that happen, though.
-
This is not an answer that explains the clear instruction the cache form must be assigned to non-volatile cache. I think part of the answer is the users may lose data if the form cache is volatile.– awmSep 25, 2013 at 14:48
-