PHP5, Windows, and Linux performance comparison

I have a question about Symfony2 performance.

I have been developing with Symfony2 under Ubuntu 11.04 for several weeks, Apache 2.2.17, PHP 5.3.5, APC 3.1.9, no xDebug

In the dev environment, the time indicated on the Symfony2 toolbar never exceeded 70 ms.

Today I tried to install the application on Windows 7: Wampserver 2.2, PHP 5.3.8, Apache 2.2.21, APC 3.1.7, no xDebug

A Windows computer is much better than ubuntu (SSD, Quad core, etc.).

And when I run the application in the dev environment, the toolbar always shows at least 300 ms.

So, do you know how this is possible?

Thank!

EDIT: Found a link to this topic: http://fossplanet.com/f6/%5Bsymfony-users%5D-symfony2-slow-windows-xp-116465/

I also noticed a problem with the file_exists function (using webgrind).

So any ideas?

Perhaps the subject has already been discussed, but I was surprised to find nothing related.

+8
performance php apc
Oct 12 '11 at 13:44
source share
4 answers

TL; DR; Set realpath_cache_size to> 1000

Edit 2:. The problem is resolved in this PR: try setting the value of PHP for real._cache_size to> 1000. Recently a symfony requirement has been added that fixes this problem: https://github.com/sensiolabs/SensioDistributionBundle/commit/cf0179711b24d84d4a29d71a4010540f4c990bd8

Edit: I just saw this answer: https://stackoverflow.com/a/312616/2122/ and it reduced the page generation time by 4 when I set realpath_cache_size = 4096k to my php.ini (!)

Old answer:

So, I compared both with webgrind:

In windows (fast computer) called app_dev.php:

Web toolbar

So, you can see that the web toolbar shows the generation time of 764 ms (increased due to xDebug and profiling, but still relevant). Webgrind shows:

  • 651 call file_exists () for 232 ms (which is a lot!)
  • 603 calls to filemtime () (211ms)
  • 230 calls for UniversalClassLoader-> loadClass () (119ms)
  • 230 calls for UniversalClassLoader-> findFile () (38 ms)

On Linux (slow computer) app_dev.php:

Web toolbar

298 ms of total generation time (which is more than half that on windows).

  • 237 calls to UniversalClassLoader-> findFile () (36ms => 4 times less)
  • 237 calls to UniversalClassLoader-> loadClass () (20ms => 2 times less)
  • 623 calls for file_exists () (only 4 ms !!!)
  • 605 calld to filemtime () (only 4 ms !!!)

The problem is that file_exists () and filemtime () are much slower than on Linux. On Windows, PHP searches for files with file_files, filemtime, loadClass, or findFile in 60% of cases. Is this a known issue?

Edit: the problem only occurs for the dev environment, there are no file files in production, since everything is cached.

+12
Oct. 14 2018-11-12T00:
source share

I was just starting to develop with Symfony2 on Windows, and it was a complete pain in the ass - I tested xcache, apc and eaccelerator, which either did not differ much or just crashed when used with xdebug.

Now I discovered Microsoft's WinCache - which made Symfony2 on Windows incredibly fast ... My requests took 1.5 to 3 seconds - with WinCache up to 200 ms . And that doesn't even bother xdebug - profiling and debugging still works like a charm.
Edit: this is all about the dev environment.

The only drawback is that it only works on nts php, and I think Apache modules require ts - if you run it with fcgid, although you won't have a problem.

I can’t believe that I worked for many years without this monster ...

References:
WinCache on php.net
Official WinCache Website
Binaries

+6
Feb 28 '12 at 18:01
source share

Interesting discovered!

I would say, since this is not a symfony2 problem at all, it should be fixed in PHP binary format.

But who manages their web server on windows, anyway ?: D

+2
Oct 12 '11 at 16:05
source share

Try it with ApcUniversalClassLoader http://symfony.com/doc/2.0/book/performance.html

+1
Oct 18 2018-11-11T00:
source share



All Articles