possible migration from lighttpd

jrmarino

Well-Known Member
#1
Hi Litespeed folks!

This is kind of a "pre-sales" question, but I couldn't find any forum for that, so this forum seemed the most appropriate.

I migrated to lighttpd from apache a couple of years ago for performance reasons. Lighttpd was kind of flakey until version 1.4.13, which it seemed very stable. This was on my FreeBSD 6.x system.

I am now the proud owner of several Sun Fire servers (2- and 4-core AMD64 Opterons) running solaris 10. Three of the servers are dedicated to the web server / php activities like so:

server A: lighttpd only
server B and C: PHP 5.2.1 / fastcgi only (port 8002)

The idea was that 1 web server could be supported by numerous PHP servers. Server A could have php installed as well, but I didn't want to risk PHP activities impacting web server performance (with 2 core / 2GB ram this probably would not have happened though)

My brief perusal through litespeed documentation indicates that PHP LSAPI (and I assume PHP-fastcgi) is located on the same server as litespeed. Does it have to be?

My question is: can litespeed be set up in the same fashion as I currently have lighttpd (1 web server, multiple PHP slave nodes)?


For curiosity's sake:
My current setup of lighttpd 1.4.13 on solaris is also flaky. My PHP fastcgi processes (externally spawned) are frequently and randomly "dying" according to lighttpd logs, although they seem fine. This ends up with a 500 server error. Lighttpd is not crashing though. I compiled both lighttpd and php from source using sun's c compiler. I can't figure out why the setup is unstable, and lighttpd is, for all intents and purposes, unsupported. Jan disappears for weeks at a time, most cries for help on the forums go unanswered.
 
Last edited:

mistwang

LiteSpeed Staff
#2
My brief perusal through litespeed documentation indicates that PHP LSAPI (and I assume PHP-fastcgi) is located on the same server as litespeed. Does it have to be?
No.
My question is: can litespeed be set up in the same fashion as I currently have lighttpd (1 web server, multiple PHP slave nodes)?
Yes, no problem at all.
PHP LSAPI 3.0 module can be started from command line, please take a look at the README in the package.
On server A, you need configure two remote LSAPI application and a load balancer, add the two LSAPI application to the node list of load balancer.

I can't figure out why the setup is unstable, and lighttpd is, for all intents and purposes, unsupported. Jan disappears for weeks at a time, most cries for help on the forums go unanswered.
It will never happen with LiteSpeed, basically, it is one of the major differences between hobby open source project and dedicate commercial proudct. :)
Fixing bugs is one of our top priority.
 

jrmarino

Well-Known Member
#3
Thanks -

On my server B, I have another instance of lighttd. In addition to servicing different websites, it also serves as a failover backup to server A. It uses the same externally spawned fastcgi processes. (in other words, the fastcgi PHP on server B accepts requests from both server A and Server B). How the failover should work is that the DNS servers detect the HTTP service on Server A has failed, so they dynamically change the IP address to server B. I have my doubts how well that will work in practice.

So my first followup question is: Is this setup also supported?

How I would foresee such a scenario:
I would set up server A with the enterprise dual-CPU version. On Server B, I would use the standard version since it's normal load is easily handled by the standard capabilities.

Second followup question:
I have 17 surges per year (currently). A surge lasts about 12 hours. It is during this time that I would need the capabilities of the enterprise server. What would the users see if there were more than 150 concurrent connections? This is a general question about using the standard version in a situation where the connection limit is reached. Are the pages just fetched slowly, or are the connections actually refused? (Know that I do not expect to ever have to use this backup capability)
 

ts77

Well-Known Member
#4
I doubt that the dns-change will help much in that area as the dns is cached deeply.

I guess you are looking for a setup like mine ;-).

I'm having a main-webserver and a backup-webserver.

In litespeed I'm using the load-balanced fcgi backends which use their local and remote backends.
the systems are backed up through heartbeat which switches the external ip to the second machine if the first one fails (it just takes some seconds).

currently I'm evaluating some load-balancers / reverse proxies to have some better control about the distribution of traffic between the two machines instead of using the fcgi-load balancing.

Edit: Oh and I'm using a similar shared licensing. The main-server has a single-cpu enterprise edition and the backup-server just uses the standard-edition.
 
Last edited:

mistwang

LiteSpeed Staff
#5
So my first followup question is: Is this setup also supported?
Yes, you can do that. You should be able to do whatever you did with lighttpd with LSWS. :)

What would the users see if there were more than 150 concurrent connections? ... Are the pages just fetched slowly, or are the connections actually refused?
When the backlog of TCP server socket is not full, the pending connection will be held in the backlog, when the backlog was full, more connections will be refused. Linux's TCP backlog can hold upto 200 connections I believe.
 

jrmarino

Well-Known Member
#6
yeah, the dns caching did worry me. It's probably not worth pursuing.

For my current setup, I compiled the php as fastcgi, and I also use it to run command-line php scripts. I assume that when I recompile php with the lsapi capability, I can still use it to run command line scripts?

By the way, the Solaris default TCP backlog is 128, but on the IBM websphere site, they are recommending set it to 8000 for their application, so apparently it is user-definable, and can be pretty long.

This is my offseason - If I install the standard version and run it for 2 - 3 months to evaluate the stability, how difficult is it to upgrade to the enterprise version when I get close to my active period? Does it roughly involve stopping the server, copying over a file or two, and restarting it?
 

mistwang

LiteSpeed Staff
#7
I assume that when I recompile php with the lsapi capability, I can still use it to run command line scripts?
Correct.
how difficult is it to upgrade to the enterprise version when I get close to my active period? Does it roughly involve stopping the server, copying over a file or two, and restarting it?
Easier than that, just run installer and select upgrade, no downtime at all.
 

jrmarino

Well-Known Member
#8
Hi, I'm just going to continue with this thread even though my questions are more technical in nature now.

I followed the instructions to build LSAPI into PHP, and I got this error with the buildconf --force:
make -s -f build/build2.mk
make: Fatal error: Command failed for target `all'
If I just configure and build PHP after that and look at the phpinfo page, it does not say LSAPI anywhere. Should it? Is the failure above going to invalidate the new build?

Is it okay to leave it as a fastcgi build, or do I need to disable all the fastcgi settings?

here is my current configure ....
./configure \
--prefix=/opt/csw \
--enable-versioning \
--with-layout=GNU \
--enable-memory-limit \
--enable-libxml \
--with-libxml-dir=/usr/local \
--enable-reflection \
--enable-spl \
--program-prefix="" \
--disable-cli \
--enable-force-cgi-redirect \
--enable-fastcgi \
--with-zlib \
--with-litespeed \
--with-regex=php \
--enable-mbstring \
--disable-json \
--disable-filter \
--without-sqlite \
--without-pdo-sqlite \
--with-mysql=/opt/csw/mysql5 \
--with-pdo-mysql=/opt/csw/mysql5
 

jrmarino

Well-Known Member
#11
In this case, the automake and the autoconf are already the gnu versions. The makefile of php calls out gcc.

It appears buildconf is just picking MAKE instead of GMAKE.

I typed "gmake -s -f build/build2.mk" in the command line and it seems to seemed to do something. let's see what happens when I rebuild PHP...


.....


ok, I rebuilt it. I see nothing in the phpinfo result or -v that indicates LSAPI was compiled in. Is there any indication at all? what would I look for?
 

mistwang

LiteSpeed Staff
#12
I think should let "make" an alias of "gmake" and override the make comes with solaris.
Both phpinfo and -v should show it is "LiteSpeed" SAPI if it is successful.
 

jrmarino

Well-Known Member
#13
I definitely do not want to do that. They are not equal, and gmake is not inherently better than make.

Are you sure the fastcgi settings (see configure) are not interfering with lsapi settings?
 

mistwang

LiteSpeed Staff
#15
I definitely do not want to do that. They are not equal, and gmake is not inherently better than make.
I have not found any open source package does not work well with gmake. Maybe some sun packages require make, but I never have any problem with gmake.
 

jrmarino

Well-Known Member
#16
okay, removing the fastcgi settings did the trick. It is showing as litespeed now.

And yes, I've had custom builds specifically say use sun's make over gmake. In fact, I only use gmake if I'm instructed specifically to do so. With sun's studio 11, the c/c++ compilers seem much improved.

I'll let you know how the rest of the install goes.
 

jrmarino

Well-Known Member
#17
I am still having trouble with LSAPI PHP.

All the instructions that I found assume that the user wants litespeed to spawn LSAPI PHP directly by calling a shell script.

That's not what I want to do, I want the LSAPI to be listening and waiting for requests.

Additionally, the instructions say use the format "lsphp -b 10.0.0.106:8008" but shouldn't this require an "&" to force it to be a background process? I set the following environment variables:

LSAPI_CHILDREN=45
LSAPI_MAX_REQUESTS=1000
LSAPI_MAX_IDLE=300
LSAPI_MAX_IDLE_CHILDREN=15
LSAPI_MAX_PROCESS_TIME=600
LSAPI_PPID_NO_CHECK=1
when I run the command, only one process shows, not 15 as I expected. Are there any instructions that specifically state how to use remote external php? Right now I'm spinning my wheels, guessing.
 
Last edited:

jrmarino

Well-Known Member
#18
I assumed these were the instructions that I wanted:

Start PHP from command line
===========================

Usually, lsphp is managed by LiteSpeed web server in a single server
installation. lsphp can be used in clustered environment with one
LiteSpeed web server at the front, load balancing lsphp processes
running on multiple backend servers. In such environment, lsphp can be
start manually from command with option "-b <socket_address>", socket
address can be IPv4, IPv6 or Unix Domain Socket address.
for example:

./lsphp -b [::]:3000

have lsphp bind to port 3000 on all IPv4 and IPv6 address,

./lsphp -b *:3000

have lsphp bind to port 300 on all IPv4 address.

./lsphp -b 192.168.0.2:3000

have lsphp bind to address 192.168.0.2:3000.

./lsphp -b /tmp/lsphp_manual.sock

have lsphp accept request on Unix domain socket "/tmp/lsphp_manual.sock"
But it doesn't work. I'm locked out of the command line after typing it in, so I have to suspend the the job and kill it manually. If I force it as a background process it does not seem to interact with litespeed (set external app address to same IP and port)
 

mistwang

LiteSpeed Staff
#19
Yes, you need to add "&" at end of the command line to put it to background. Maybe add "nohup" to the command line as well,
Code:
nohup ./lsphp -b ... &
It will not start 15 processes at beginning, a new PHP process will be forked when there is a new request comes in.
 

jrmarino

Well-Known Member
#20
I still can't get this to work. The single lsphp process is sitting there waiting, but clicking on the php test link still attempts to download it as a file.

I have set up the script handler for "php" extensions. That leaves me to think that that the external app is not correctly set up. Can you please list out what the settings should be for a remote setting? For example, should the instances be 0 or 1? Should the address match what I put into the -b option?

assuming the script handler is set up right, and assuming LSAPI PHP is working, what else would cause this not to work?
 
Top