This is an old revision of the document!


How to improve initial PHP response without cache for an idle site?

To improve the site performance, the key step is to enable cache to avoid PHP processes. However, the cache may not be able to use for some situations or applications, and you will need to improve PHP performance by enabling opcode cache, choosing higher PHP version which has better performance, disabling xdebug and snmp php modules if they were enabled accidentally or increacing PHP suEXEC Max Conn when WaitQ is frequently higher than 0, etc. You can check this wiki on how to improve PHP performance in detail.

For an uncachable site, if it is not busy and has been idle for some time, when a new visitor comes in, the initial PHP loading time could be very slow while the second request is fast. Assuming the opcode cache enabled for the site, what could be the reason to make initial PHP response time slow?

One possible reason could be due to the PHP startup time. You may or may not know: PHP processes are dynamically spawned and it may take time to start a PHP process. ''Max Idle Time'' will control how long the php will keep alive for that site when idle. If such an initial response is critical to your site, you may want to change “Max Idle time” to let it running loner, for example, changing from “60” to “86400” (1 day) through LSWS Web Admin Console under PHP tab to reduce the PHP startup time.

The other possible reason could be CloudLinux LVE limits IO/IOPS. When an account idle for while, data is not in kernel cache anymore, PHP need to load many things from disk, the IO limits slow PHP down when loading file from disk. That's the main factor that a page will take a long time to load if idle for a while. In this situation, you can try raising the IO limit or disable the IO limit.

  • Admin
  • Last modified: 2020/01/15 20:16
  • by Jackson Zhang