S
S
Sergey2012-09-28 00:57:19
PHP
Sergey, 2012-09-28 00:57:19

PHP performance on Windows. Why so slowly?

Actually a couple of months ago it happened that I had to deploy Apache directly under Windows (Windows 8). I used to work under a virtual machine with Debian and everything was more or less normal.
While working with Symfony2 projects, I encountered a significant performance hit. The profiler showed that the preg_match, file_exists and PDO functions worked out the longest. Problems with PDO were solved by specifying the IP address directly as a host, but problems with file_exists and preg_match remained. The execution of these functions takes about 40% -50% of script processing.
Moreover, on a machine with ubuntu / debian, the profiler does not show any anomalies and, in general, the code works out ten times faster (0.3 seconds versus 3-4 seconds on Windows).
As an experiment, today I installed Debian under a virtual machine on the same partition as the project code. I made performance measurements and it turned out that under Debian, even in a virtual machine, the performance increase in PHP reaches 300%, and for MySQL queries are executed 2 times faster.
The system is clean, nothing much has changed in the settings. Everything (from Windows to a virtual machine) is hosted on an SSD. I am personally surprised by such low performance. Perhaps something is wrong with me, therefore, I am interested in whether anyone has come across this and how it is treated.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Anatoly, 2012-09-28
Protko @Fesor

file_exists is the weakest link + the sum of all includes. In Windows, access to the file system is an order of magnitude slower. Partly because of this, performance suffers, if you remove all pieces of code that somehow relate to the file system, then the speed will be slightly inferior to Linux (one file with some kind of algorithm). And while this situation exists, we will have to put up with it.

D
Dmitry Artemenko, 2012-09-28
@SpectraL

I may be wrong, but there are probably several reasons:
1 Differences in configuration files out of the box for Linux and Windows versions
2 After all, Windows is not as native an environment as unix systems

S
shagguboy, 2012-09-28
@shagguboy

put APC or another cacher.
although it is strange. On my seven, the demo page opens in 0.07 seconds.
maybe the runtimes are not the same?

V
Vampiro, 2012-09-28
@Vampiro

I couldn't win. Even ramdisk does not save. Too much is included in the Symphony. The cache alone contains 1k files per 40MB, and for each file it also checks the modification date ... I had to install vbox. There is the possibility of starting machines without a window, so as not to clog the taskbar.
I would be happy to find an answer here as well.

B
BoneFletcher, 2012-09-28
@BoneFletcher

Buying an SSD helped me. Using APC, in the prod environment, the request takes 200ms, in the dev - 1000ms.
Before the replacement, there was a laptop 2.5 "5400 rpm - a request in the dev environment (using APC) was executed for 5-8 seconds.

N
nuclear, 2012-09-28
@nuclear

I won by installing Zend Server, xdebug seems to be disabled
ramdisk, apc and much more does not help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question