LSWS 4.2 Introduces PHP suEXEC Daemon Mode

LSWS 4.2 release has a great news for shared hosting providers, who can get most advantages of the much expected new feature.  This release introduces PHP suEXEC daemon mode, which will improve memory efficiency of PHP processes, as well as overall server performance.

The advantages of PHP suEXEC daemon mode are:

    1. Reduce PHP startup cost.

In suEXEC daemon mode, new PHP processes are started by using fork() system call , instead of starting a brand new PHP process. Comparing to launching a new process, fork() is much faster, and it can take advantage of copy-on-write virtual memory management by OS kernel.

    1. Improve Opcode cache efficiency.

Opcode cache memory can only be shared among children processes forked off the same parent process. For standalone PHP processes, each process will allocate its own opcode cache memory, and release it when the process exits. In suEXEC daemon mode, all PHP worker processes are forked off the same parent process running as root, PHP opcode cache memory are shared by all PHP processes, and it won’t be flushed as long as the parent process still running. Since opcode cache can now be shared among all users, with saved memory, you will be able to allocate larger memory block for opcode cache; in return, more compiled PHP scripts and variables can stay in cache with improved cache hit rate.

So, how to take advantage of this new feature?

  • The easiest way is to reinstall LSWS 4.2 from scratch in which PHP daemon mode will be enabled by default.
  • If you cannot do a fresh reinstall, you can follow the below steps to enable the feature:
  1. Upgrade to 4.2 first, suEXEC daemon mode is disabled by default.
  2. Recompile PHP with latest LSAPI 6.0. You can build matching PHP from WHM plugin, or from LSWS web console where LSAPI 6.0 code will be used by default.
  3. Enable PHP suEXEC daemon mode by updating lsphp5 external application configuration From LSWS web console, change from “Run On Start Up” to “suEXEC daemon”.
  4. Repeat step 2-3 for each PHP external application if multiple versions of PHP are used.

Note: This feature is not yet supported on Solaris.

Tags: , , , , , ,

2 Responses to “LSWS 4.2 Introduces PHP suEXEC Daemon Mode”

  1. [...] LSWS 4.2 introduces PHP suEXEC daemon mode Switching from Apache: Open_Basedir in the Shared Hosting Environment [...]

  2. […] year, we introduced PHP suEXEC daemon mode. It’s been popular for a number of reasons, most notably because forking child processes from […]