Hi,
It seems like in the default configuration for the litespeed server, it will wait till the entire PHP result is generated, and then it will reply with a Content-Length.
I would expect that for a long running script, which streams its response over a number of seconds, that Litespeed would reply with a chunked encoding.
In this topic mistwang (the LS employee) replied stating chunked encoding should be avoided. I can appreciate that chunked encoding has overhead and that it's more efficient to use a Content-Length when sending/receiving HTTP messages; however, for a slow PHP page this isn't ideal.
For an e-commerce site, that may take a few seconds to load, waiting the entire page load time means the browser can't begin processing css/javascript includes. This results in a worse experience for the user, regardless of overhead.
An example PHP script to produce this with the LSAPI is:
If you run this against the LSPHP binary, it will appropriately print 1 through 9 as they are generated (every 1 second); however, if you run this through litespeed, you'll have to wait for the entire page to load.
Is there any way to make it so that Litespeed "streams" or chunks the reply, so it doesn't wait to generate the content-length based response?
Thanks!
It seems like in the default configuration for the litespeed server, it will wait till the entire PHP result is generated, and then it will reply with a Content-Length.
I would expect that for a long running script, which streams its response over a number of seconds, that Litespeed would reply with a chunked encoding.
In this topic mistwang (the LS employee) replied stating chunked encoding should be avoided. I can appreciate that chunked encoding has overhead and that it's more efficient to use a Content-Length when sending/receiving HTTP messages; however, for a slow PHP page this isn't ideal.
For an e-commerce site, that may take a few seconds to load, waiting the entire page load time means the browser can't begin processing css/javascript includes. This results in a worse experience for the user, regardless of overhead.
An example PHP script to produce this with the LSAPI is:
Code:
<?php
for($i = 1; $i < 10; $i++){
print "$i<br>\n";
sleep(1);
}
?>
Is there any way to make it so that Litespeed "streams" or chunks the reply, so it doesn't wait to generate the content-length based response?
Thanks!