Hi, at start sorry for my english.

On Your website is written that php with litespeed sapi is faster than fastcgi php. I tested this on my production server and portals and forum scripts like invisionboard are generated much slower. IPB in about 0.1s by lsapi and 0.03s in fastcgi mode. That's a big difference, about 300%! :( Both were compiled with almost the same directives, uses APC and same php.ini. Tested on lsws 2.1RC3 with default config (same results on 2.1RC2)

Maybe i configured some wrong?

ps. What Environment variables has lsapi that i can use in extrenal apps?


LiteSpeed Staff
Thank you for your feedback.

We are surprised by the result as well, can you please send us your LSAPI PHP and FCGI PHP configuration, output of phpinfo().

LSAPI's advantage over FCGI, is the communication cost between LSWS and PHP process, the pure execution speed of PHP script should be the same. So, I expect the result of speed measurement within PHP should be identical.

One possible explanation is that FCGI PHP cache the whole html page generated, and send the script at the end of the request, LSAPI does not use a buffer that big and send partial content, which add some delay during IPC I/O, those delays is added into the overall PHP execution time.

How big is the page generated in your test?

Do you have a isolated test server that you can use 'ab' to measure the performance, not just the speed measurement within PHP?

We will do some tests in our lab.



Well-Known Member

We have buffering enabled for the PHP, for all of the pages, in order to catch errors and present customized pages instead. Does it mean that in this case we should continue using FastCGI, because of the buffer size? Or there any way to increase the buffer size via options?


Well-Known Member

Perhaps it's better to set this parameter to "On", and not limit it at all? Or the LSAPI is optimized best to work with 8K?

Crazy Serb

Well-Known Member
8K is the best setting for LSAPI.
Does this recommendation still hold?

And do you have a wiki page or something showing the optimal settings for heavy traffic servers with multiple accounts/tons of traffic on each? Something that shows the best settings in terms of PHP, Litespeed, Apache even (as Litespeed config is kinda linked to it).

As some of us are still tweaking the Litespeed settings years later and they are providing on and off sort of performance... I'd like to find some sort of an ultimate configuration for dedicated servers with 16+ cores and 64-128GB of RAM that make sense and can handle thousands of users per second on any given day, other than going through trials & errors on a daily basis...