How WordPress serves efficiently

As per my knowledge I know that PHP file can not serve two clients at same time, so in WordPress index.php will be the file handling all requests, so how it is all the way efficient and faster? is there any logical clustering? or any programming techniques in PHP that WordPress follows? I have a website built on index.php where all requests comes to index.php and seems it lags in performance for fewer requests, dont know how it is going well for WordPress or to some other CMS?

Related posts

Leave a Reply

1 comment

  1. There is no built-in limit such as “one client per file”. You can customize your limits on your webserver and/or your fastCGI pool if you’re using one. It will be more accurate to think in terms of “one php thread per request”, but even that could be misleading depending on your scenario.

    WordPress’s index.php is just a router that in turn picks a theme template and renders it replacing each variable according to the request. No magic there, just basic templating logic.

    You index.php lag might be caused by several reasons, including but not limited to:

    • You are referencing external js script in the header, which will
      temporarily block page rendering.
    • You are trying to establish an early DB connection to a slow or high latency DB server
    • You are making heavy SQL queries on each request
    • You are not caching sections of the page that are subject to little or no modification from one request to the next
    • You are using file based sessions on a slow storage machine
    • You are not using an opcode cache AND you’re doing an expensive PHP calculation on each request.
    • You have a poorly tuned webserver that allocates too much resources for each request, even for static assets.