Jump to content

What exactly makes a site lag?


Recommended Posts

Let's say I have a page A that takes 20 seconds to load due to the number of database calls being generated.  And then I have another page B that takes 2 seconds to load because it's less database intense.

If person 1 goes to page A, the server will start the page rendering process and 20 seconds later the page will be served.

If person 2 goes to page B right after after person 1 went to page A, will person 2 see the page B in 2 seconds or 22 seconds?

Meaning, what factors go into play in terms of how Apache/PHP/MySQL responds multiple large requests, server resources (cores, memory), etc.?  This is something I never really understood but I'm doing some big performance optimizations and it would be helpful to have an understanding what's going on deep down.  Any resources would be appreciated.

Link to comment
Share on other sites

Short thoughts (on mobile ATM): PW cache API, PW template cache, PW ProCache, PHP memcache(?)

AFAIK, Apache without ProCache handover a request to PHP, PHP has everything to rebuild what is not cached in some sort (cache API for pages or chunks of any sort; template cache for a complete template markup, or a complete "php page" in memcache). When things have to be rebuild, the mysql server gets involved too. At best would be PC, omits PHP and MYSQL; second would be PHP, it omits the MYSQL server; somewhere in between is a mix of cached and uncached bits that builds a complete page markup.

Another strategy, (if its practical depends on your project(s)): serve a more or less bare HTML markup, with maybe direct content only for header section, H1 and first paragraph(s), and fetch all under the fold with progressive lazyloading (wide threshold). Or a combination of all. ?

EDIT: additional: If you need to serve individual pages for each request, check your fields setups. Maybe you can "move"  or optimize some parts to get be prepared on page save in the admin. (additional fields, hidden for the editors, that can contain combined data, that lowers the number of db requests for visitors, at a small cost for the authors on page save)

Edited by horst
additional info
Link to comment
Share on other sites

Thanks for the reply.  The purpose of my question is ultimately related to priming my ProCache cache.  Right now, I have a whole bunch of optimizations in place, but when I deploy my site, I purposely clear all cached pages as they need to be rebuilt.  If I have a script to primes 50 pages that each take 20 seconds to prime, one after another right after deploy, I'm wondering to what extent this makes the site inaccessible during the priming process.  My question is what is it that exactly causes a site to lag for one person while another person (or my priming script) is loading intensive pages?

  • Like 1
Link to comment
Share on other sites

9 hours ago, Jonathan Lahijani said:

If person 1 goes to page A, the server will start the page rendering process and 20 seconds later the page will be served.

If person 2 goes to page B right after after person 1 went to page A, will person 2 see the page B in 2 seconds or 22 seconds?

I think person 2 sees page B in 2 seconds. I did a kind of test...

I have two pages and two templates: page "Yellow" uses template "colour" and page "A Basic Page" uses template "basic_page". There's nothing special about the template file for basic_page but in the template file for colour I have:

sleep(30);

If I load page Yellow in one tab and then immediately load A Basic Page in another tab then I have to wait 30 seconds to view either page. But if I load page Yellow in one tab and then immediately load A Basic Page in an incognito window (which will have a different session) then the page loads immediately.

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...