possible migration from lighttpd

Discussion in 'Feedback/Feature Requests' started by jrmarino, Apr 9, 2007.

  1. jrmarino

    jrmarino Well-Known Member

    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: Apr 9, 2007
  2. mistwang

    mistwang LiteSpeed Staff

    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.

    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.
  3. jrmarino

    jrmarino Well-Known Member

    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)
  4. ts77

    ts77 Well-Known Member

    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: Apr 11, 2007
  5. mistwang

    mistwang LiteSpeed Staff

    Yes, you can do that. You should be able to do whatever you did with lighttpd with LSWS. :)

    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.
  6. jrmarino

    jrmarino Well-Known Member

    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?
  7. mistwang

    mistwang LiteSpeed Staff

    Easier than that, just run installer and select upgrade, no downtime at all.
  8. jrmarino

    jrmarino Well-Known Member

    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:
    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 ....
  9. jrmarino

    jrmarino Well-Known Member

  10. mistwang

    mistwang LiteSpeed Staff

    You need to install GNU m4/gmake/autoconf/gcc, make sure those tools is used instead of sun's.
    You can try a different version as well.
  11. jrmarino

    jrmarino Well-Known Member

    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?
  12. mistwang

    mistwang LiteSpeed Staff

    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.
  13. jrmarino

    jrmarino Well-Known Member

    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?
  14. mistwang

    mistwang LiteSpeed Staff

    fastcgi settings should be removed from configuration. Only one SAPI extension can be built.
  15. mistwang

    mistwang LiteSpeed Staff

    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.
  16. jrmarino

    jrmarino Well-Known Member

    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.
  17. jrmarino

    jrmarino Well-Known Member

    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" but shouldn't this require an "&" to force it to be a background process? I set the following environment variables:

    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: Apr 13, 2007
  18. jrmarino

    jrmarino Well-Known Member

    I assumed these were the instructions that I wanted:

    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)
  19. mistwang

    mistwang LiteSpeed Staff

    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,
    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.
  20. jrmarino

    jrmarino Well-Known Member

    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?

Share This Page