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

Cache rebuilder for BB code parse cache

Discussion in 'XenForo Suggestions' started by Chris D, Jul 18, 2013.

  1. Chris D

    Chris D XenForo Developer Staff Member

    If you have an existing 1.1.x board that has been upgraded to 1.2.x then you are likely to have a massive number of posts that have not had the BB code parsing tree cached.

    As a result, the first person to view a page in a thread will trigger each post in that page to have its cache inserted into the xf_bb_code_parse_cache table.

    This has the potential to increase the query count for loading that page by X where X is the number of posts you show per page.

    On a board that I'm yet to upgrade to 1.2, that could be as many as 40 additional queries.

    Although these queries only happen for the first person to view that page, and only ever happen once, I still wonder if it would be better to provide a cache rebuilder so we can run this ourselves at an appropriate time.

    Personally on sites I'm involved with they're usually on big VPS' or dedicated servers so it's not an issue. But those additional queries happening at run time (as small as they are) could potentially adversely affect performance.
    semprot, Walter, BamaStangGuy and 4 others like this.
  2. Marcus

    Marcus Well-Known Member

    Imagine: XenForo fetches the forum template, and everytime it checks if the template is cached within the file system. If not, it saves it as a file.

    Why not save the bbcode once its created? Why check every page view if posts are cached? It's rather old school.Yes the current BBCode Implementation hurts definitly Googles impression of the speed of our community. From what I heard, it means less money coming from Adsense if you have a slower web page.

    This super short shell script at least puts the first page of all threads in the cache:

    for ((i=PUTYOURHIGHESTTHREADIDHERE$i>=0i--)); do
    wget  --no-cache --spider  http://domain.com.de/threads/$i/
    echo $i

  3. Marcus

    Marcus Well-Known Member

    I just thought about this option as it does sum up to a serious amount of data within the database. I guess the bbcode parse cache only speeds up a page when there are bbcodes used within the posts? It would be great if someone would just confirm it.
  4. Mike

    Mike XenForo Developer Staff Member

    The speed up is more significant on complex posts, yes.
    Marcus likes this.
  5. silence

    silence Well-Known Member

    In case anyone wants to still do this, modified @Marcus script to do every post :D

    for ((i=0; $i < $POSTNUM; i++)); do
      curl -ILk https://$WEBSITE/posts/$i/
      echo $i
    Marcus likes this.
  6. Marcus

    Marcus Well-Known Member

    Awesome :)

Share This Page