Litespeed and eAccelerator on Mac OS X

#1
I've installed Litespeed Standard 2.1.14 on a test iBook running Mac OS X 10.4.5 (PPC), and for the most part it appears to function. There are a few gotchas I've come across, which I'll explain below as I document the process.

- Install wget, which is required by the installer but is not on OS X by default
Code:
$ sudo port install wget
- Download and install Litespeed
Code:
$ tar xzf lsws-2.1.14-std-ppc-osx.tar.gz
$ cd lsws-2.1.14
$ sudo ./install.sh
- Answers to relevant install-time questions
Code:
Destination [/opt/lsws]: /usr/local/litespeed
User [nobody]: www
Group [nobody]: www
HTTP port [8088]: 80
Admin HTTP port [7080]: 9007
Setup up PHP [Y/n]: Y
Suffix for PHP script(comma separated list) [php]:
Would you like to change PHP opcode cache setting [y/N]? N
Would you like to install AWStats Add-on module [y/N]? Y
Would you like to import Apache configuration [y/N]? N
Would you like to have LiteSpeed Web Server started automatically when the machine restarts [Y/n]? N
Would you like to start it right now [Y/n]? Y
After installation was complete, I was able to test the built-in PHP module via:

http://localhost/phpinfo.php

I did some benchmark testing via Apache Bench on the above URL but was only able to get about 68 requests per second. I used the enable_phpa.sh command line tool to turn the APC cache tool on and off, but it did not appear to make a difference.

I decided to try some of the other caching tools, but ran into several problems. With mmcache, for example, the download link from the download page...

http://www.litespeedtech.com/packages/mmcache/mmcache-php-4.4.2-ppc-osx.tar.gz

...results in a 404 "File Not Found" error (just click the above link and you'll see what I mean).

Okay, so much for mmcache. Let's try eAccelerator. I run enable_phpa.sh and select item #3 (eAccelerator), and the following is the output.

Code:
http://www.litespeedtech.com/packages/eaccelerator/eaccelerator-php-4.4.2-ppc-osx.tar.gz
           => `eaccelerator-php-4.4.2-ppc-osx.tar.gz'
Resolving [url]www.litespeedtech.com[/url]... 69.56.199.218
Connecting to www.litespeedtech.com|69.56.199.218|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
12:34:12 ERROR 404: Not Found.

[WARN] Can not retrieve binary package for eaccelerator from [url]www.litespeedtech.com[/url], 
       please download it manually from 
           http://www.litespeedtech.com/download.html 
       or build binary from source code.
       Please make a symbolic link from eaccelerator.so.4.4.2 to
       /usr/local/litespeed/lib/eaccelerator.so.
Whoa. eAccelerator is at version 4.4.2? No, it's currently at 0.9.4. It looks like some copying-and-pasting went on when the enable_phpa.sh script was written, and all that was changed for eAccelerator was the name (thus it having the same version number as mmcache).

I tried compiling eAccelerator manually via the following steps and then selecting it via enable_phpa.sh, but doing so broke PHP completely, and I had to revert to APC.
Code:
$ tar xzf eaccelerator-0.9.4.tar.bz2
$ cd eaccelerator-0.9.4
$ sudo /usr/bin/phpize
$ ./configure --enable-accelerator=shared --with-php-config=/usr/bin/php-config --with-eaccelerator-userid=www
$ make
$ sudo make install
$ sudo cp /usr/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so /usr/local/litespeed/lib/
$ cd admin/misc
$ sudo ./enable_phpa.sh
Any suggestions as to how I can eAccelerator installed and working with Litespeed and the PHP LSAPI module?

Thank you!

Justin
 
#2
Any suggestions?

We would like to deploy Litespeed instead of Lighttpd or Apache, but that unfortunately won't be an option if we can't get Litespeed to play nicely with eAccelerator.

Xing? Mistwang? Anybody have any suggestions as to how we might get Litespeed working on Mac OS X with the leading PHP opcode accelerators? I tried above to provide as much detail as possible, but if you need additional information to help troubleshoot the problem, by all means please let me know.

Looking forward to your suggestions! :)
 

xing

LiteSpeed Staff
#3
Justin, sorry for the late reply. Schedule off wack.

First off, the pre-configured install options for PHP opcode caches are a bit update and looking forward, we would likely remove all both mmcache and eacc and default to APC 3.0 in the near future. One reason is that APC is simply the most well developed product at the moment backed several key PHP developers.

I would highly recommend you to use the latest APC opcode module from http://pecl.php.net/apc . Try that with OS X. You will have to install the developer tools on your ibook to get gcc/compiler packages. You will have to compile and install it yourself.

From my personal experience with APC, which has had major stability upgrades the past 6 months, is now the defacto PHP opcode cache module to beat. Zend is non-free so we can ignore them.

LiteSpeed does have a 24/7 live OS X (Intel) server testing our software non-stop so I will try to install PHP and APC on it tonight to see it how it goes. I don't see any potential problems.

Lastly, you are probably curious why I recommend APC over eAcc. The answer is pretty simple, I started on eAcc and have always had php segfaults, though at a very small volume, per day. Since the move to APC, 3.0 branch I have not had a single problem with the opcode cache. Our in-house LiteSpeed test machines gets tested very hard 24/7 with live traffic as we have agreement with a few websites so based on that, I'm sold on APC 3.0.
 

xing

LiteSpeed Staff
#5
Try this:

APC 3.0.10 on OS X (intel)

1) download/expand PHP 5.1.2

2) cd into php-5.1.2/sapi

3) download and expand lhttp://www.litespeedtech.com/lsapi/litespeed-1.9.tgz into the "sapi" folder of php source.

4) in php source directory, do

Code:
touch ac*
./buildconf --force
5) Configure/Compile php

Code:
'./configure' '--prefix=/xingwww/php5' '--with-litespeed' '--with-config-file-path=../conf'
make
make install
6) Replace the lsphp binary (backup first) in /lswsinstall/fcgi-bin/lsphp with
/xingwww/php5/sapi/litespeed/php.

7) Download/Expand APC from http://pecl.php.net/package/APC . In APC source dir do:

Code:
/xingwww/php5/bin/phize
./configure --enable-apc--mmap --with-php-config=/xingwww/php5/bin/php-config
make
make install
Using --enable-apc --enable-apc-shm will give errors on os x.

8) Configure /lswsinstall/conf/php.ini

Code:
extension=apc.so
include_path = ".:/xingwww/php5"
;extension_dir = ./
Setting above size=4 (4MB) gives errors right now. Also make sure that extension_dir is commented out.

9) Critical for OS X. By default, OS X kernel does not allow shared memory segments over 4MB. So right now, apc.so wil fail to load with some "can't load null" error.

edit or make /etc/sysctl.conf if doesn't exist already with following values:

Code:
kern.sysv.shmmax=134217728
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.sysv.shmall=32768
10) Reboot to get the kernel sysctl values updated and enjoy APC on OS X with LiteSpeed PHP LSAPI. =)

That's it.
 
#6
Thank you!

Thank you for the detailed responses! They were very helpful.

xing said:
Setting above size=4 (4MB) gives errors right now.
I'm not sure where in the php.ini file you are referring to here, so I made no changes other than the three lines you explicitly mentioned.

I have Litespeed running with APC 3.0.10, and running the "siege" load test tool locally for 30 seconds on phpinfo.php on a dual 1.0 GHz G4 Xserve produces the following results:
Code:
$ siege --concurrent=10 --time=30S --delay=0 --url=http://localhost/phpinfo.php
Transactions:                   5775 hits
Availability:                 100.00 %
Elapsed time:                  30.25 secs
Data transferred:          172615343 bytes
Response time:                  0.05 secs
Transaction rate:             190.91 trans/sec
Throughput:               5706292.50 bytes/sec
Concurrency:                    9.94
Successful transactions:        5775
Failed transactions:               0
Longest transaction:            0.27
Shortest transaction:           0.01
I have no idea whether the above results are indicative of typical performance with Litespeed+APC on the above-mentioned class of hardware; perhaps you can take a look and let me know what you think.

The next step is getting Rails running on Litespeed via the Ruby LSAPI module (as opposed to fastcgi). If you could possibly test Rails via the Ruby LSAPI on your MacTel server and document the steps as you did above and post them in the new thread I created, I imagine you will have a number of very grateful folks (including me!) :D

Thanks again for all of your help!

Justin
 
Top