 |
 | Apache Worker, PHP, and PhpExpress |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Mon Mar 23, 2009 1:07 pm |
|
 |
 |
 |
 |
Seems what you need is perfromance under heavy load that would ideally be the same as performance without load. The common term that describes this is known as scalability. For example if your server can handle 2000 requests per second with one connection and 2000 requests pre second for 200 connections (10/sec for each in average), it'd mean that the scalability is ideal. From my experience, if you try to draw chart Total# of requests vs number of concurrent connections, you'll get horizontal line (100%) that propagates to some certain number of connections and then quickly (or slowly) degrades. Take number of connections that corresponds to 70% and focus on this. Continue running the tests with this number of connections and try to determine what is the bottleneck. Sometimes it's CPU, sometimes HDD, sometimes it's amount of memory. You may want to attach strace utility to all httpd children processes and check what they are actually doing. You'll see all the kernel calls with high-granularity timer. By knowing the bottleneck you can think about partial hardware upgrade, not replacement. For example if it's amount of memory (too much swaps), you may want to add extra modules. If you already have 3-4GB, you may want to switch to 64bit OS to get all the installed RAM used, if it's HDD, you may want to replace disks with higher capacity (they often have better performance because of data dencity) or better rpm, group 3-4 disks into raid5 array, and so forth. Also, don't forget about all php configure and run-time settings, such as always overseen ZEND_MM_MEM_TYPE, ZEND_MM_SEG_SIZE, ZEND_MM_COMPACT, USE_ZEND_ALLOC environment variables. BTW USE_ZEND_ALLOC=0 is what I'd start all the checks.
After you find and fix the bottleneck, re-run the tests, draw the line, and look for the new bottleneck
Anyway, I would not play with things that are known to be unstable (such as PHP under Threaded Worker). Even after the stability is announced, I'd wait for 6month or more  Maybe it's just my conservatism.
If you believe "thread-safe" PhpExpress would help you, please contact me by email or pm and I'll do my best to help. On the other hands, I'd like to see "numbers" with and without 
|
_________________ The PHP IDE team
|
 |
 | |  |
Joined: 23 Mar 2009 |
Posts: 8 |
|
|
 |
Posted: Mon Mar 23, 2009 5:50 pm |
|
 |
 |
 |
 |
I am starting to hate the internet. Maby I am looking the wrong way and I sould start with the docummentation.
I haven't heard about ZEND_MM_MEM_TYPE, ZEND_MM_SEG_SIZE, ZEND_MM_COMPACT, USE_ZEND_ALLOC, USE_ZEND_ALLOC and I am glad I did, even now.
I have always believed that searching the internet for "php performance" will only give 5% good answers and the rest will be just copy&paste and useless information and I guess I was right.
Thank you for the tips above I will look into it.
I am not convinced that thread-safe is the solution yet, I am only testing because there are so many opinions on the internet that it's almost impossible to be sure of something. Right now what bothers me a lot is the realpath issue. I have straced httpd and built statistics and tried to reduce the number of system calls as much as I could.
So far an important difference I have seen with and without thread-safe is the fact that Apache will server a lot of websites faster since a lot of requests are for static content, that is why some folks use nginx for static content, but that is not a "safe" solution yet, it's just like my experiments with worker, there are always some problems
Thank you for your help so far, If I will have problems and I will need help I will contact you.
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Wed Mar 25, 2009 7:49 am |
|
 |
 |
 |
 |
Quote: | So far an important difference I have seen with and without thread-safe is the fact that Apache will server a lot of websites faster since a lot of requests are for static content |
Correct. Either multithreading apache or lightweight without any huge code in all the modules web server will do.
As of PHP, it's not that obvious. If you try to optimize performance in non-loaded case (1 connection at a time) you'll end up with php cache and php loaded as module. If you try to optimize performance for max. loaded case (50%-70% degradation in perfomance as I mentioned before is a good point to focus on), you may end up with no caches at all, leaving all possible memory to OS to have disks and filesystem cached better and may be php loaded in FastCGI pool. At least it makes sense if most of the request are against plain files (html, js, css, images, other non-php).
Quote: | I haven't heard about ZEND_MM_MEM_TYPE, ZEND_MM_SEG_SIZE, ZEND_MM_COMPACT, USE_ZEND_ALLOC, USE_ZEND_ALLOC and I am glad I did, even now |
I think, they were not discussed because Zend didn't even plan to document them.
Just fyi, Zend uses a kind of cache for memory blocks. When PHP VM releases a memory block, Zend's memory manager don't return it to the OS. Instead, it adds the block to the internal list of free blocks and will return it next time a block of the same size is requested. It works very good on a relaxing system, when a lot of memory is available and only a few processes are active. On a heavily loaded system, it may make more sense to release all non-needed memory to OS immediately.
I'd highly appreciate if you run tests and provide the results 
|
_________________ The PHP IDE team
|
 |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT - 5 Hours
Page 1 of 2
|
|
|
|  |