'Magento 1.9 add to cart slow when cached
We have been experiencing an odd issue on some of our sites since moving from Magento 1.7 to 1.9. When a sites cache hasn't been cleared for a while add to cart is extremely slow. This also affect the checkout. As soon as we clear the cache it speeds up again.
I can not really make sense of why this happens. I have tried profiling to see what it is that takes a long time and it seems that mainly the events that take place _afterSave function in Mage_Core_Model_Abstract is the culprit. Mainly the follwing event is run several two times and takes about 10 seconds in totasl to run: sales_quote_save_after
cleanModelCache also takes about 6 seconds to run after the save function on the cart have run.
I am looking at our modules that are installed and it doesn't seem like we have any in use utalizing this event.
EDIT
After som more testing I realized that the function that taskes a long time is the cleanModelCache function that cleans the following cachetags
[0] => quote
[1] => quote_1002 (quote_ID)
This function is run twice during the add to cart and it takes about 5 seconds each time. If I clear the cache this is instant.
edit For now we have installed Redis for session management and caching on the server and this seemed to have solved out issue. If it seems like a permanent sollution I will add it as such on this post.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|