0

I develop a web server's PHP scripts to retrieve tiled images to cover Earth surfaces such as World Wind. Suppose I have get_image.php that returns image/jpeg or image/png as the response.

The initial condition is also that I have Windows Server 2003 to test my script on and preinstalled Apache 2.2.16 with a thread model. So I had to install thread safe PHP 5.3 to use it as Apache's module.

After script has been succesfully written I decided to produce a load testing using JMeter. Starting with a single virtual user performing a request per no more than 0.5 seconds and increasing the number of virtual users every minute at the moment of nine virtual users I get some not handled requests though looking in server's Task Manager I see no more than 8-10% of CPU. The maximum performance I get is 1600-1700 successful responses per a minute (requests are produced by eight virtual users).

I am not a system administrator and not experienced dealing with heavy performances, so my question is: can this be a problem of PHP thread safety discussed here? How can I determine the problem I face? Would it be better to try my script as CGI with IIS + FastCGI or we have to look at Linux-based web server?

P.S. I also use memcached server and php_memcache.dll (so-called thread safe version) downloaded from http://downloads.php.net/pierre. This module is not officially supported for Windows and probably it's not really thread safe so it could cause an additional effect to my problem in the case of the problem described is PHP thread safe issue.

Community
  • 1
  • 1
ezze
  • 3,933
  • 2
  • 34
  • 58

1 Answers1

2

If I were you I would use XDebug to track down which parts of your application ar eating the time and causing the failed requests.

Since you are on windows ( i presume ) then you can use a handy little program called WinCacheGrind to open and review the output files. It will show you, line by line or function by function, exactly how long the different blocks of code in your application take to run.

If you find that there is nothing surprising in the grind then that is the time to start looking at the environment.

Ben Duffin
  • 1,066
  • 10
  • 16
  • Hello, Ben. Thank you for the reply. I have already used `XDebug` for debugging purporses during writing the code, and I'm quite sure that my script is as fast as possible. I will look at `WinCacheGrind` (it's very interesting to face new useful tools) but from my point of view the problem is in the environment. – ezze Oct 18 '11 at 08:54
  • By the way, I also tried to use `Alternative PHP Cache` downloaded from [here](http://downloads.php.net/pierre) but `Apache` has some problems - it doesn't respond after 1000-1500 requests. In its `error.log` I can see that some threads were unable to be finished correctly, and a little bit later get the message that they have been terminated. – ezze Oct 18 '11 at 09:04
  • Finally, there are problems with environment. Windows is not suitable to be used as secure server platform for PHP with port of memcached. – ezze Feb 28 '12 at 16:28
  • Now come on - Windows isn't really a suitable server full stop now is it? lol! – Ben Duffin Mar 07 '12 at 13:39
  • Although I am sorry that I couldn't help more - I do run both windows and linux servers but I have never experienced a problem like yours - although I have not tried using Memcached on the windows box ... looks like its experimentation time!! – Ben Duffin Mar 07 '12 at 13:40
  • Thanks for comments. I'm not a system administrator but a developer so I can't judge with a confidence. All my attempts to solve this issue on Windows failed. I suggest the problem is that there is no official stable Windows port of memcached extension for PHP (and probably, due to PHP's thread-safety issue on Windows). After all, I wrote Windows service application on C++ that listens for requests and respond with images and additional info. In summary, both IIS and PHP were replaced by this one. Unfortunatelly, I disappointed by PHP support on Windows. – ezze Mar 07 '12 at 14:23