I guess memcache does not store more than 1Mb

Rigel Kentaurus

Well-known member
Today while looking at my queries I realized that it was always retrieving from the xf_data_registry the "styles" key. But just that one. All the rest were happily being fetched from Memcache, but that particular query, always there.

Code:
            SELECT data_key, data_value
            FROM xf_data_registry
            WHERE data_key IN ('styles')

After debugging things a little (and I actually needed to output an strlen() of the itemData), I realized that the size of my styles was bigger than 1Mb (1.3, actually), and after doing some research, turns out that MemCache's default is 1Mb, anything bigger than that will not be stored.

A workaround would be enabling compression (I had that disabled), and just deal with the fact of compressing and uncompressing everytime an object is saved and load from the cache.

The other workaround is just increasing the window size for Memcache from 1Mb to something bigger. I actually went with this one.

......

I don't have that many styles. I have 12, and a lot of them are disabled, I wonder if they make it to the cache even if disabled (my guess, yes)
 
I don't have that many styles. I have 12, and a lot of them are disabled, I wonder if they make it to the cache even if disabled (my guess, yes)

Just a thought; if the styles are not in use (and you don't envisage using them anytime soon) how about exporting them and removing them from your board.

Would that help reduce the cache overhead/queries?

Cheers,
Shaun :D
 
Just a thought; if the styles are not in use (and you don't envisage using them anytime soon) how about exporting them and removing them from your board.

Would that help reduce the cache overhead/queries?

Cheers,
Shaun :D
Most likely, yes.
They are seasonal, so some we are definitely not going to use until, say, February next year (and even then they will need changes most likely)

I think I might end up removing them since I am not too keen on PHP unserializing a 1.2 Mb object every page load.
I know serialization is efficient, but .. every bit counts.
 
Top Bottom