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

Does a -very- large SimpleCache slow down Xenforo?

Discussion in 'XenForo Development Discussions' started by Marcus, Oct 7, 2012.

  1. Marcus

    Marcus Well-Known Member

    I am thinking of putting lots of stuff in SimpleCache - as its so simple :D SimpleCache is available on every page in XenForo. So is there a problem if I really put lots of stuff there (100 MB, 1 GB, 20 GB)? I have 64 GB RAM and only use a fraction of it.
  2. xfrocks

    xfrocks Well-Known Member

    Data Registry can only hold 16MB of serialized array so you can't fill your RAM with it. Also, serializing/deserializing big array takes a lot of time, especially when the system must do it for every request. I wouldn't recommend doing that.
    Xon, cclaerhout, Jake Bunce and 2 others like this.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The simpleCache is automatically loaded on every page so it's good for small data because it saves you a query. But if the data is large then you are talking memory footprint. If you don't need the data on every page then the extra memory footprint might not be worth it.

    For data that is not needed on every page you might consider creating your own registry entry:


    Using your own registry entry adds one query when you access the data.
    cclaerhout likes this.
  4. cclaerhout

    cclaerhout Well-Known Member

    I didn't see this message, thanks Jake ! The way to use that registry record is as easy as to use the simplecache!
    I've just have a few other questions:
    • When you say "small data", how small is that? 200, 2000, 20000 characters? I think I've read in one post (may be yours) that the data were stored in db as 'mediumtext' (16777215 characters).
    • So in theory if coders want to store datas they have to share that amount and can't go over?
    • And just to check, is it the same with the registry solution?
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yes, all registry records are limited to 16M of data by the column type. An individual registry record can be up to 16M. The entire simpleCache (being its own record) can be up to 16M. Keep in mind that the simpleCache is shared by all addons so don't be a hog.

    If you are loading 1M or more of data into the simpleCache then you need to start thinking about memory footprint. That's arbitrary though.
  6. cclaerhout

    cclaerhout Well-Known Member

    明白! Perfectly clear. Thank you !

Share This Page