Support » Plugin: LiteSpeed Cache » Why am I using this plugin when I have a CDN?

  • Hey guys,

    One thing I am completely confused by is why I am using your plugin when all my assets, JS, CSS, images etc are served up by my CDN, Stackpath.

    My ISP recommended the plugin because we run on Litespeed, but since I can set things like TTL, browser cache renewal etc on my CDN, what am I gaining from using the plugin? Is there anything else going on that’s allowing WP to talk directly to my Litespeed server?

    Sorry to be a little backwards on this, I’m just looking for some clarification.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support LiteSpeed Lisa

    (@lclarke)

    Hi, @demonboy

    Your CDN serves the static assets.

    LiteSpeed Cache handles the dynamic content of your site. The HTML of your WordPress site is generated on the fly, via PHP, every time a visitor requests a page. PHP is an expensive process, and so LiteSpeed caches the HTML so that it is not necessary to invoke PHP. This speeds everything up considerably.

    Even if your CDN can cache your site’s HTML, it can’t be smart about it. LiteSpeed, on the other hand, knows when content has changed, and is able to purge the outdated version of that post from cache, along with related content (like the home page, category pages, or date archives).

    We have a much more detailed guide into how all of this works on our blog, if you’d like to understand it better.

    Let us know if you have any other questions!

    Hey Lisa, thanks for the quick response, appreciated. The one thing I need to get my head around is setting TTL. I have set this on my cdn for 12 hours so should I enable this in the plugin to be the same, or not keep that disabled?

    Also I have set one page on my cdn not to be cached, which is my login page. Should I relocate replicate these settings within the plugin as well? I’m still confused as to whether I should be caching at both ends or just one.

    Hi @demonboy, the caching concept is like this:

    User browses your site —> Check CDN Cache(return if not expired) —> Check LiteSpeed server cache(return if not expired) —> Run the WordPress code and render frontend.

    So you can keep 12hours TTL on Litespeed cache and when every time you update the content, try to purge the cache on both side simultaneously.

    For the login page, if it’s pre-set WordPress page it will not be cached. If it’s a custom page and you want to exclude it from the cache, please put the path on Setting > Exclude > Do Not Cache URIs

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    For best results, you should not cache HTML with your CDN, or on the browser. You should let LiteSpeed handle that part. The CDN and browser cache are great for static content, but they can easily get out-of-date when you write new posts, edit an existing post, or otherwise update your content.

    You can keep your TTL at 12 hours for the static content on the CDN and browser, if that works for you. But you don’t need to repeat that on the LiteSpeed side for the dynamic content. In fact, you can set quite a long TTL with LiteSpeed, if you want to, since the plugin is smart enough to purge the relevant pages from the cache if content changes.

    All of these caches are unrelated to each other, so you don’t need to use the same TTL for them all.

    The most important point, though, is not to use the CDN or browser to cache dynamic HTML content. For best accuracy, let LiteSpeed handle that.

    Hope this helps. LMK if you need more clarification!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Why am I using this plugin when I have a CDN?’ is closed to new replies.