Initial page load slow compared to Apache+mod_php?

Discussion in 'PHP' started by Sindre, Jan 16, 2009.

  1. Sindre

    Sindre Well-Known Member


    I am doing some tests with LSWS and the PHP LSAPI. From my experience, it takes a bit longer before a page is served on the first access compared to Apache with mod_php. I was under the impression that the LSAPI should be even faster than Apache+mod_php? The site is an eCommerce store based on Magento Commerce (heavy PHP/MySQL). After the first load, subsequent accesses are handled very fast, so this is bugging me a bit. I really like LiteSpeed.

    Are there some settings in the admin I can tune to speed up the inital page loading time?

    I already have enabled the "Run On Start Up" option for the lsphp5 ext. appl and set "Instances" to 1. Does the "priority" setting or "response buffering" have any effect?

    I am running LiteSpeed Enterprise 1-core on a Intel QuadCore system, which should leave 3 cores for PHP and MySQL processing.

    Thank you for your advise! :)
  2. mistwang

    mistwang LiteSpeed Staff

    Are you using cPanel + LiteSpeed? are you using PHP suEXEC? Are you using a VPS? PHP opcode cache? It should be fast no matter what.
  3. Sindre

    Sindre Well-Known Member

    I'm using LiteSpeed with cPanel (Apache replacement) and suEXEC enabled. I have ionCube, eAccelerator and Suhosin loaded with PHP, and also the "Mail Header (Identifies Mail Source)" extension was checked when compiling PHP.

    It is a dedicated server, Quad-Core Q6600 CPU with 4GB RAM.

    I have the 1-core license. Does this mean that lsphp5 (the external app) will only use 1 core, or is it just static content that will be affected by the 1-core limit?
  4. mistwang

    mistwang LiteSpeed Staff

    Try the "Building Matching PHP" function in our WHM plugin. 1-core license only affect static content.
  5. Tony

    Tony Well-Known Member

    What priority are you running php at? I've changed mine to -5 as I found the default did not give enough priorty -5 made it equivalent to my previous suPHP setup's priority for PHP.
  6. Sindre

    Sindre Well-Known Member

    The priority is set to default (1). At least that is what cPanel -> "Show Current CPU Usage" reports for lsphp5.
  7. mistwang

    mistwang LiteSpeed Staff

    Is this for shared hosting, or dedicate for one or a few large web sites?
    How slow is the first request?
    It may be a network problem.
  8. Sindre

    Sindre Well-Known Member

    I doubt it is a network problem. The server is in DedicatedNow (FortressITX) data center, which has a very reliable network. It is shared hosting (about 50) PHP/MySQL intensive ecommerce sites.

    E.g. if I have not accessed a particular site in some hours (over the night), it can take up to 3 seconds where it just "hangs", then the whole page is loaded at once. Subsequent requests are near instant. Could it be related to the eAccelerator opcode cache?
  9. mistwang

    mistwang LiteSpeed Staff

    I think it may be the browser. Some browser can only render certain web page all at once after all embedded elements has been received, image, css, js, etc.
    Other browser maybe do better, try different browser, like IE, FF, Opera, etc.

    For subsequent requests, the images, css, js have been cached, so once the main page html has been received, the page can show up.

    You can check the loading speed with FireBug and find the request that takes long time to complete.
  10. txyoji

    txyoji New Member

    The behavior you describe sounds like your using the cgi module for php.
    This site -
    explains that the litespeed module is configurable in admin panel and is very similar to the fast cgi module.

    Look for a setting in your litespeed server that will keep a couple of php processes hot or perhaps a cron job to wget the page at regular intervals would help.

Share This Page