|
From: Decent E. <dec...@gm...> - 2025-09-19 15:38:23
|
Caching entire content pages is generally not recommended, especially when pages are personalized, since cache reuse is typically poor. Instead, I suggest setting a maxentry value to prevent a single large page from evicting the entire cache. It is also good practice to monitor the cache statistics in nsstats to evaluate how well your caching parameters perform — paying attention to metrics such as cache reuse and mutex contention. I’m using the caching on mysql-heavy pages, such as “what products are currently on sale, and in stock?” with a 10 minute cache refresh. Example: https://decentespresso.com/sale - some of these queries run in the 1 to 2 seconds range, which is slow enough so that crawlers hitting my site hard will take it down. The 10 minute cache occasionally causes problems if people order an item faster than every ten minutes, in which case we can accidentally oversell an item. I’ve thought about having a more general mysql cache in place, as SQL UPDATE commands that invalidate SQL SELECTS are quite rare. Possibly, the right approach would be to rearchitect the mysql schema so that queries always run quickly, so that I don’t need to add my own caching. -john |