slow result

Discussion in 'Install/Configuration' started by shadowlight, Nov 3, 2006.

  1. shadowlight

    shadowlight Member


    My issue will be long to explain but I will try to put as much information as it is possible.

    Here are my system :

    CPU 3 Ghz (no HT no dual core) 32 bit
    2G ram

    @@ OS and Web Server @@
    I'm running FreeBSD 6.1 with Litespeed 2.2.1 (the latest for FreeBSD)

    @@ PHP @@
    php -v
    PHP 5.1.6 (cli) (built: Nov 2 2006 23:10:09)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

    @@ MySQL @@
    mysql Ver 14.12 Distrib 5.0.24a, for portbld-freebsd6.1 (i386) using 5.0

    @@ Litespeed @@
    I have the latest version for FreeBSD of enterprise litespeed 1 CPU lease 1 Year. Currently running on the temp license the time to receive my full license.

    @@ LiteSpeed Config file @@
    <?xml version="1.0" encoding="UTF-8"?>
    <expiresByType>image/*=A604800, text/css=A604800, application/x-javascript=A604800</expiresByType>
    <domain>, *</domain>
    <domain>xxxxxx, *</domain>

    @@ Vhost config file @@

    <?xml version="1.0" encoding="UTF-8"?>
  2. shadowlight

    shadowlight Member

    @@ System logs /var/log/messages @@

    Nov 2 21:11:57 Navy4 kernel: pid 50032 (httpd), uid 80: exited on signal 6
    Nov 2 21:11:57 Navy4 kernel: pid 49997 (httpd), uid 80: exited on signal 6
    Nov 2 21:11:57 Navy4 kernel: pid 50067 (httpd), uid 80: exited on signal 6
    Nov 2 21:11:57 Navy4 kernel: pid 50235 (httpd), uid 80: exited on signal 6
    Nov 2 21:11:57 Navy4 kernel: pid 50060 (httpd), uid 80: exited on signal 6
    Nov 2 22:11:09 Navy4 kernel: pid 69743 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 2 22:12:01 Navy4 kernel: pid 79646 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 2 22:18:49 Navy4 kernel: pid 13817 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 2 22:19:55 Navy4 kernel: pid 23858 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 2 22:22:59 Navy4 kernel: pid 60002 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 2 23:33:33 Navy4 kernel: pid 65316 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 2 23:50:33 Navy4 last message repeated 5 times
    Nov 3 00:07:20 Navy4 kernel: pid 4515 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 3 00:13:51 Navy4 last message repeated 5 times
    Nov 3 00:58:10 Navy4 kernel: pid 23588 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)
    Nov 3 01:30:07 Navy4 kernel: pid 23866 (lshttpd.2.2.2), uid 80: exited on signal 11 (core dumped)

    I compiled fscgi/lsphp from /usr/ports/lang/php5/work/php-5.1.6/sapi/litespeed as per the doc.

    copy the litespeed php sapi source and copy it to the php source/sapi folder.
    cd phpsource/ && ./configure --with-litespeed && make
    cp phpsource/sapi/php litespeedroot/fscgi/lsphp

    Symptom :

    PHP is working but it is slow. I changed the timeout value to 25 instead of 75 but i had to put it back to 75 since i received timeout error.

    I can see in my process list more than 20 lsphp process and 3-4 lshttpd

    When I start lshttpd from litespeedroot/bin/lshttpd start or lshttpd.2.2.2 start it works fine.

    When i stop lshttpd from litespeedroot/lshttpd stop or lshttpd.2.2.2 stop it return an error.
    ./lshttpd stop
    [OK] Your trial license key will expire in 30 days!
    [ERROR] LiteSpeed Web Server is running!

    PHP has been installed from the ports.

    php -m
    [PHP Modules]

    [Zend Modules]

    I use the kqueue module and litespeed accelerator (i think not sure)
    I activate sendfile () module too.
    Currently while testing I put the exact same concurrent connection as our apache setup. While apache were using all the RAM with 1024, litespeed used only 1.1G of Ram keeping 900M for more client. (this include mysql, php, webserver).

    The Site has 50 000 member registered (will grow up to 150 000) and concurrent user were between 400-1024 (limit of apache for our server with 2G of ram before it swap too much)

    We would like to reach 10 000 concurrent member with php and litespeed and mysql. (AT a minimum much more than 1024).

    Right now since it is really slow, we are really deceived. But I think it's probably something i did or didn't who make it slow. I would greatly appreciate all help to get this server running and optimized. Since we paid for the license we would greatly appreciate to beat our apache setup.
  3. mistwang

    mistwang LiteSpeed Staff

  4. shadowlight

    shadowlight Member


    Yes this is what I have.

    By the way, I found why it was slow.

    the php module was cap with 20 connections. I grow it to 100 and now it cans handle the load. I will test tomorrow on a busy hour to find out what it cans handle :)

    If you have any suggest following my spec to optimized my setup, feel free to guide me.

    Thank you,
  5. shadowlight

    shadowlight Member

    I'm still having an issue with litespeed. I cannot stop it from lshttpd stop.

    Please advise.

    Thank you,
  6. shadowlight

    shadowlight Member


    Yesterday night, we had a load of about 70 request second and the server fall on his knee. It used all the ram and swap, Our apache setup did better at this time. I just shutdown litespeed and put apache back.

    Any help is welcome. In fact, we would really need a quick start guide with someone experienced.

    Thank you,
  7. mistwang

    mistwang LiteSpeed Staff

    The command to stop lshttpd is "lswsctrl stop" not "lshttpd stop".

    Is that for a vbulletin board?
    You probably set "max connection" for lsphp module too high. usually, 20 is enough for most setup, unless your php scripts take long time to process.

    First thing first is to make sure a php opcode cache work properly in your setup, usually, something will be added to a phpinfo page when it works, like APC or eaccelerator.

    Usually, php 4.4.4 has better performance than php 5, so if your PHP code work with php 4, use php 4 instead. Make sure all required php modules has been compile into the binary.

    We will help you here to tune the web server as much as we can. Also we have one-time installation service $149 to help people setup and tune their LSWS installation for their web site, if you really need help, please that a consideration if you have a hard time to tune it by yourself. :)
  8. shadowlight

    shadowlight Member


    swsctrl stop give me the same error.

    The one-time installation service $149 would be welcome, but I will give myself 7 days to try tuning it.

    I will install php4 and will diminish the number of lsphp max connect. I will give the url for phpinfo in my next post.

    Thank you,
  9. shadowlight

    shadowlight Member


    How can I enable php acceleration?

    Thank you,
    Last edited: Nov 4, 2006
  10. mistwang

    mistwang LiteSpeed Staff

  11. shadowlight

    shadowlight Member


    eaccelerator is install now.

    I will create you an admin account as you can review my setting and maybe optimise it a little more.

    Our goal like i said is to provide 150 000 customers nearly. We currently have 50 000 customers. We are constantly with 1000 user at the same time with average of 80 request seconds.

    Let me know how i can communicate with you for the admin account.

    Thank you,
  12. shadowlight

    shadowlight Member


    I found that i have as much request processing as I have php process.

    Plain SSL Max Idle Plain SSL
    In Out In Out Used Avail Used Avail
    22 94 0 0 2,000 14 77 1,923 0 400

    Request Rate
    Scope Requests in Processing Request/Second
    Server 63 55
    www.ixxxxxx 63 54
    ApacheMain 0 0
    _AdminVHost 0 1

    External Apps
    Scope Type Name Max CONN Eff Max Pool In Use Idle WaitQ Req/Sec
    Server LSAPI phpLsapi 200 200 200 60 140 0 50

    Does it means, each connect will use one phpLsapi connector ?

    Thank you,
    Last edited: Nov 4, 2006
  13. mistwang

    mistwang LiteSpeed Staff

    Do not over-tune phpLsapi to start too many php processes, LSWS can pipe-line requests to PHP backend when there are more concurrent requests than number of PHP process. 200 should be the maximum, I recommend you try 50-100 first. Running too many PHP process may use too much memory and slow down the whole server.
  14. xing

    xing LiteSpeed Staff

    For some perspective, PHP process/children value of 20-40 is more than enough to handle millions of php pages per day provided your code is properly tuned. Setting PHP processes to a high value only if your backend/database can support that many concurrent connections and still be fast. There is no point setting PHP process pool to 100 if your mysql server will die at 50 concurrent connections.
  15. shadowlight

    shadowlight Member

    Currently, my MySQL database is running on the same server as my litespeed daemon. With apache, i setuped my mysql to 500 connections up to 1024. it were working but I had few error about mysql cannot connect. with 100 as value for lsapiphp i had no error of this kind. Than it should be fine for now.
  16. xing

    xing LiteSpeed Staff

    For performance reasons, you need to increase "thread_cache" entry for mysql config, my.cnf, and decrease mysql's max_connection item. Unless you have a super fast disk i/o on quad core server with no table/db locking, 500 mysql connections will instantly bring your server to its knees.

Share This Page