1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I guess memcache does not store more than 1Mb

Discussion in 'XenForo Development Discussions' started by Rigel Kentaurus, Apr 12, 2013.

  1. Rigel Kentaurus

    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.

                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)
  2. Mike

    Mike XenForo Developer Staff Member

    They do as admins can still use them.
    bousaid and Rigel Kentaurus like this.
  3. CyclingTribe

    CyclingTribe Well-Known Member

    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?

    Shaun :D
  4. Rigel Kentaurus

    Rigel Kentaurus Well-Known Member

    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.
    CyclingTribe likes this.

Share This Page