by
KK » Tue Mar 17, 2015 3:49 am
With caching turned on, when a page is requested by a *non-loggedin* user, first the cache is checked for a static copy of that page. If one is found, it is served and the request ends.
If, however, a static cached copy is not found, the page is generated the usual way and a copy of it is saved in the cache for the future requests.
So, except for the first request, every other time only the static copy is served. No database is involved.
Wouldn't caching only apply after the page has loaded? Initial loading would slow, right?
As explained above, caching is a one-time affair (until the cache is invalidated by changes in the admin-panel). So the first-time the loading would be the same as a normally generated page. Every other time it should be discernibly faster.
I'm kinda curious about this, why is a big gallery so slow when a small one isn't?
That would also depend on your coding. Single pages (page-view) shouldn't ever be a problem. Listing pages (home-view, folder-view) can get slower if you use cms:pages to fetch in hundreds of pages in a single go (should use pagination to fetch only a reasonable number of pages on a single page e.g. 50 or 100).
From what you reported, you are seeing the opposite of this - your folder-views are fine. It is the page-view that is slow which is puzzling.
When I'm looking at my page as a logged out user - is the site not using the database actively?
Yes. But only when caching is on because then the logged out user is served a static HTML file - no database hit is involved at all.