Author |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Fri 02 Jan '15 19:43 Post subject: |
|
|
Some topics on ApacheLounge related to this thread:
http://www.apachelounge.com/viewtopic.php?p=29455
http://www.apachelounge.com/viewtopic.php?p=29416#29416
http://www.apachelounge.com/viewtopic.php?p=23273#23273
https://www.apachelounge.com/viewtopic.php?p=26552#26552
http://www.apachelounge.com/viewtopic.php?t=5789
Background on building for XP/2k3 with Visual Studio 2012:
http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx
(note that the SDK is in Microsoft SDKs\Windows\v7.1A, not in \7.1A)
The %path%/%lib%/%include% settings were no problem. Adding /D_USING_V110_SDK71_ to every compiler staement was a lot harder. For Apache and OpenSSL (Fips) a lot of additions to makefiles were needed. Adding /SUBSYSTEM:CONSOLE,5.01 to the linker options was more of the same.
Compiling PHP 5.6 for XP/2K3 has two obstacles: inet_pton/inet_ntop and GetTickCount64.
GetTickCount64 was the easiest one. Just revert the last two changes in select.c
https://github.com/php/php-src/commit/99afc6dc11016be47ce2ba09779ae4a34d435f5b
https://bugs.php.net/bug.php?id=65268
The ext/sqlite3 extensions also make use of GetTickCount64. php_slite3.dll compiles and loads, but I am not sure if it really works. php_mysqlnd_qc.dll uses sqlite3 and I could not get it to compile at all.
inet_pton/inet_ntop was a lot more difficult. PHP formerly had its own code for it in win32/inet.c. It still is there in PHP 5.4. The PHP 5.4 version of win32/inet.c calls Ws2tcpip.h in the Windows SDK. Ws2tcpip.h in its turn calls inet_pton in ws2_32.dll and this fails on XP. I had to find a way to get around this obstacle without changing the Windows SDK. The final solution (1) copy win32/inet.c from PHP 5.4 to PHP 5.6 and (2) change the values of _WIN32_WINNT and NTDDI_VERSION in win32/build/config.w32.h.in. They were:
#define _WIN32_WINNT 0x0600
#define NTDDI_VERSION 0x06000100
I changed that into:
#define _WIN32_WINNT 0x0501
#define NTDDI_VERSION 0x05010200
BTW: 0x0501 reflects /SUBSYSTEM:CONSOLE,5.01 for XP targetting.
So far, so good. Compiling for XP could start. But some extensions did not compile yet. I got php_sockets.dll to compile by copying the complete sources for ext/sockets from PHP 5.4 to PHP 5.6. Really tricky, but it worked.
php_intl.dll (international support for unicode and the like) was a different story. I finally got it to compile by changing the subsystem 0x0501 back to 0x0600 at the end of win32/inet.c.
Summary for 0x0501/0x0600: configuring PHP is done with 0x0501, the core is built with subsystem 0501/5.01 (XP), but most of the extensions are built with subsystem 0600/6.00 (W7+). See the discussions under http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx on this topic. In many cases VC11 programs will just run on XP/2K3.
As a practical example: standard Apache build does not include mod_fcgid.so. I just copied the VC11 mod_fcgid.so and it ran fine.
Management summary: do not use it in production.
PS. I also removed REQUEST_TIME_FLOAT, so ApacheBench runs on phpinfo() without failures. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Sat 03 Jan '15 2:35 Post subject: |
|
|
I will contribute some windows 2003 Setup options and tuning.
First let me give you some stats about one of my web servers which I use for running smaller websites.
For medium size websites I use the same setup except with more RAM and CPU cores.
Windows 2003R2 Enterprise SP2 x86
Total disk usage (including swap file) - 3.8 GB
Total memory usage (Apache running with no traffic) - 202 MB
Total Paging File 1024 MB
This server has three partitions C, D, E and the following apps installed:
Windows OS only Drive C:
Page File 1024 MB Drive D:
Firefox Portable Drive D:
PsPad Portable Drive D:
Auslogixs Defrag Portable Drive D:
WinRar Portable Drive D:
Apache Drive E:
PHP Drive E:
MySQL Drive E:
phpMyAdmin Drive E:
WordPress \www Drive E:
The server has three partitions for a reason.
Drive C: is entirely dedicated to OS and thus it suffers minimal fragmentation and has its own set of permissions. This partition can be quickly restored in case of failure. It has only 1.7 GB size.
Drive D: is used for installing applications and stores the swap file. The swap file is a fixed size which minimizes the disk fragmentation and also improves performance.
All applications are portable thus they do minimum damage to the registry and in case of OS failure and necessity to restore drive C: all applications are intact because all their components and settings are on drive D:
Drive E: is entirely dedicated to web server and php. This allows setting separate access permissions to this partition and minimizes potential access to C: partition where the OS is stored. It also allows for fast copying of various web applications between my webservers because all of them have the same setup so by copying partition E: from one webserver to another I can copy the database, php, apache, and all the scripts and then start the application on another webserver without reinstalling.
Here are some benchmarks:
Windows 2003R2 x86 Ent. - VPS with one core 2.8 GHz
Apache 2.2.27 mod_php - PHP 5.3.8 ts
ab -c100 -n1000 http://localhost/phpinfo.php
Serving 237 Requests /s with 329 MB of Ram Usage Slim like Cindy Crawford at 18
http://i1381.photobucket.com/albums/ah219/jimski7/Win2003_zpse0d21739.jpg
Windows 7 X64 Ult. - VPS with one core 2.8 GHz
Apache 2.4.10 mod_php, PHP 5.3.28 ts
This is a slim version tuned to the max and still a dog.
ab -c100 -n1000 http://localhost/phpinfo.php
Serving 182 Requests /s with 1.6 GB of Ram Usage Ugly fat McDonald fed pig
Windows 2003R2 shows 30% better performance than Win7 x64 with only a fraction of used resources.
With widows 2008 and 2012 those numbers are even worse.
Windows 7 x86 performs better but still little slower than win 2003R2
Here are the 2K3 running processes:
http://i1381.photobucket.com/albums/ah219/jimski7/proxesses_zps6d5bbdf5.jpg
Here is Memory Usage:
http://i1381.photobucket.com/albums/ah219/jimski7/memory_usage_zps78d6879f.jpg
I will post some benchmarks using the latest Jan-E builds in a few days.
Last edited by jimski on Sat 03 Jan '15 7:27; edited 6 times in total |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Sat 03 Jan '15 4:24 Post subject: |
|
|
jimski wrote: | Windows 2003R2 shows 30% better performance than Win7 x64 with only a fraction of used resources. |
I was experiencing about the same 30% difference between XP and Win7pro (same hardware, same Apache+PHP on the same SSD-drive). Then I turned off 'real time protection' in the MS Security Essentials, that was protecting both XP and Win7. The difference disappeared. Security Essentials proved to be far more aggressive in Win7Pro (64bits) than on XP. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Sat 03 Jan '15 4:50 Post subject: |
|
|
The benchmarks that I posted above are with the real time protection already turned Off. Please keep in mind that my Win 2003 as well as Win7 are stripped down, trimmed and tuned to the max with only minimum number of services running.
Edit:
After installing the same version of Apache 2.4.10 and PHP and giving both servers the same php.ini and httpd.conf here are benchmarks.
Windows 2003R2 x86 Ent. - VPS with one core 2.8 GHz
Apache 2.4.10 mod_php - PHP 5.3.28 ts VC9
ab -c100 -n1000 http://localhost/phpinfo.php
Serving 252 Requests /s with 336 MB of Ram Usage
Windows 7 X64 Ult. - VPS with one core 2.8 GHz
Apache 2.4.10 mod_php, PHP 5.3.28 ts VC11
ab -c100 -n1000 http://localhost/phpinfo.php
Serving 212 Requests /s with 1.52 GB of Ram Usage
This is much better in terms of requests /s but the memory usage on Win7 is terrible and disk usage is equally bad.
And all of this is a result of 10 years of Microsoft software development and billions of dollars on RND?
http://channel9.msdn.com/Forums/Coffeehouse/250408-Vista-cost-10-Billions-to-develop
One more thing, time to make a backup of win 2003 is half of that Win 7. Also network traffic is cut substantially if you do backups over the network.
Utilization of hardware and VPS density when running Win 2003 VPS is substantially better than any later version of windows.
http://i1381.photobucket.com/albums/ah219/jimski7/Win-2012_zps6aa60d55.jpg
Last edited by jimski on Sun 04 Jan '15 12:11; edited 1 time in total |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Mon 05 Jan '15 21:58 Post subject: |
|
|
jimski wrote: | Windows 2003R2 x86 Ent. - VPS with one core 2.8 GHz
Apache 2.4.10 mod_php - PHP 5.3.28 ts VC9
ab -c100 -n1000 http://localhost/phpinfo.php
Serving 252 Requests /s with 336 MB of Ram Usage
Windows 7 X64 Ult. - VPS with one core 2.8 GHz
Apache 2.4.10 mod_php, PHP 5.3.28 ts VC11
ab -c100 -n1000 http://localhost/phpinfo.php
Serving 212 Requests /s with 1.52 GB of Ram Usage |
In stead of spending many hours to squeeze a little bit more out of the boxes, you'd better invest in extra CPU power. The stats on my laptop are as follows:
Windows XP Pro, i5-2520M CPU, 2 cores, 4 threads, 2,50 Ghz
Apache 2.4.10 VC11 mod_php, PHP 5.6.4 ts VC11, Opcache
ab -c100 -n10000 http://localhost/phpinfo.php
Serving 833 Request /s
Windows 7 Pro is 4% slower with exactly the same setup.
Windows 7 Pro, i5-2520M CPU,, 2 cores, 4 threads, 2,50 Ghz
Apache 2.4.10 VC11 mod_php, PHP 5.6.4 ts VC11, Opcache
ab -c100 -n10000 http://localhost/phpinfo.php
Serving 797 Request /s
In both cases mod_fcgid is slower, even if I give the system the time to spawn 40-50 php-cgi's.
Win XP, mod_fcgid, PHP 5.6.4 nts VC11, Wincache: 762 Req/s.
Win 7, mod_fcgid, PHP 5.6.4 nts VC11, Wincache: 702 Req/s.
8% slowdown on Win7 vs XP, but slower than the ts version as mod_php.
There was no noticeable difference between the VC11 builds for XP/2K3 and the genuine VC11 (PGO-optimized) builds.
I loaded the following extensions: curl, fileinfo, gd2, gettext, intl, mbstring, mysql, mysqli, openssl, pdo_mysql, pdo_sqlite, soap, sockets, sqlite3, xsl, excel, ffmpeg, uploadprogress and opcache on ts mod_php, wincache on nts mod_fcgid. See
https://phpdev.toolsforresearch.com/ApacheVC11_with_PHP564_on_XP.htm
https://phpdev.toolsforresearch.com/ApacheVC11_with_PHP564_on_W7.htm
With extly the same extensions I am getting 3700 Requests/sec on a Centos 6 box with a Intel E3-1270 v2 CPU (twice as many cores/threads, 40% higher CPU frequency). If I take the better CPU into account that is almost twice as fast as the same process on XP/Win7. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Tue 06 Jan '15 1:25 Post subject: |
|
|
Jan-E wrote: | In stead of spending many hours to squeeze a little bit more out of the boxes, you'd better invest in extra CPU power. |
I only starve little websites on one logical core. All my mother servers have 16 logical cores and 132GB of RAM and my serious websites run on Nginx and Linux with generous CPU allocation.
Jan-E wrote: | ...If I take the better CPU into account that is almost twice as fast as the same process on XP/Win7. |
I have exactly the same experience on Centos 6.5.
Too bad that Apache with mod_fcgid does not support multiple concurrent requests per process, without it any hosting on Apache on windows is really not very efficient. But either way 2003/XP is still the fastest platform for a webserver with the smallest footprint. |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Mon 11 May '15 9:30 Post subject: |
|
|
For those of you that still like older versions of windows here is a method to break the 4GB memory limit.
http://forums.evga.com/HOW-TO-Removing-4GB-Memory-Limit-on-32-bit-Windows-m960087.aspx
I haven't tried it on xp but on win 7 it works well. Occasionally a driver may fail but this happened to me only once with an older pci card.
If this tutorial looks too difficult then get yourself win 2003 Enterprise or Datacenter on ebay and you can run all the same programs as on XP except with 64 GB RAM |
|
Back to top |
|
C0nw0nk
Joined: 07 Oct 2013 Posts: 241 Location: United Kingdom, London
|
Posted: Tue 12 May '15 11:40 Post subject: |
|
|
jimski wrote: | For those of you that still like older versions of windows here is a method to break the 4GB memory limit.
http://forums.evga.com/HOW-TO-Removing-4GB-Memory-Limit-on-32-bit-Windows-m960087.aspx
I haven't tried it on xp but on win 7 it works well. Occasionally a driver may fail but this happened to me only once with an older pci card.
If this tutorial looks too difficult then get yourself win 2003 Enterprise or Datacenter on ebay and you can run all the same programs as on XP except with 64 GB RAM |
Why dont you just go set the paging file to be system managed ? Or is that something not included in Windows server 2003 i never used it for something like your trying to do so i can not be sure if you have access to that or not. But from my experience setting the paging file to be system managed fixed all sorts of memory limit problems.
https://support.microsoft.com/en-us/kb/237740
http://windows.microsoft.com/en-gb/windows/change-virtual-memory-size
I think you would be better of using the paging file because looking at that method you linked to, It is probably making the entire system unstable and shall result in even worse problems. |
|
Back to top |
|
ng4win
Joined: 25 May 2014 Posts: 78
|
Posted: Tue 12 May '15 20:53 Post subject: |
|
|
640k ought to be enough for anybody |
|
Back to top |
|
jimski
Joined: 18 Jan 2014 Posts: 196 Location: USSA
|
Posted: Wed 13 May '15 15:57 Post subject: |
|
|
C0nw0nk wrote: |
Why dont you just go set the paging file to be system managed ? Or is that something not included in Windows server 2003 i never used it for something like your trying to do so i can not be sure if you have access to that or not. But from my experience setting the paging file to be system managed fixed all sorts of memory limit problems... | I think you are confusing issues. Windows paging file has nothing to do with 4GB RAM addressing limit on windows x86. My post is about overcoming RAM addressing limit. But to answer your question on windows 2003 and xp a fixed paging file works by far better than system managed because there is no disk fragmentation and the swap is set as a one continuous block (assuming enough disk space have been allocated for swap)
ng4win wrote: | 640k ought to be enough for anybody | Actually sometimes it is enough. I run several webservers with 640K of RAM and it is plenty for a website that serves a couple thousand requests per day. Windows 2003 require very low resources. And the swap file is not being even used as long as videos are served from Youtube or CDN and there are no uploads.
Actually Win 2003 guests on Hyper-V 2012 host with shared memory allocation make an excellent use of available resources. |
|
Back to top |
|
_ck_
Joined: 05 Aug 2015 Posts: 3
|
Posted: Wed 05 Aug '15 16:04 Post subject: Re: Experimental: PHP 5.6 and Apache 2.4.10 VC11 for 2K3/XP |
|
|
Jan-E wrote: | I had to make some very experimental builds of Apache and PHP 5.6.4 |
Hey I just wanted to thank you for sharing the php 5.6 build for Windows XP
Been stuck with using 5.4 for testing stuff at home since I intend to use XP until April 2019
There is definitely a performance difference between 5.4 and your 5.6 build, your 5.6 is much faster and uses less memory. Haven't found any problems with it yet.
I'm not using it for public web serving but I am still concerned about some of the CVEs that came out between 5.6.4 and 5.6.11
If it is not a crazy amount of work, maybe you'd consider re-doing this for 5.6.12 which is RC1 now and about to ship:
https://raw.githubusercontent.com/php/php-src/PHP-5.6/NEWS
I assume 7.0 on XP is a pipe-dream, but I can live without 7.0 since they retired all the mysql_ functions. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Wed 05 Aug '15 16:46 Post subject: Re: Experimental: PHP 5.6 and Apache 2.4.10 VC11 for 2K3/XP |
|
|
_ck_ wrote: | If it is not a crazy amount of work, maybe you'd consider re-doing this for 5.6.12 which is RC1 now and about to ship |
It is a crazy amount of work, so I won't do it. I already have 20 different versions to compile: 5.3, 5.4, 5.5, 5.6, 7.0 * x86, x64 * TS, NTS.
The XP version required changes in all the sources of PHP it self and of all the dependencies. This was a one time experiment.
_ck_ wrote: | I assume 7.0 on XP is a pipe-dream, but I can live without 7.0 since they retired all the mysql_ functions. |
Hmm. My PHP7 builds still contain php_mysql.dll (and php_ereg.dll). |
|
Back to top |
|
_ck_
Joined: 05 Aug 2015 Posts: 3
|
Posted: Wed 05 Aug '15 17:09 Post subject: Re: Experimental: PHP 5.6 and Apache 2.4.10 VC11 for 2K3/XP |
|
|
Jan-E wrote: | Hmm. My PHP7 builds still contain php_mysql.dll (and php_ereg.dll). |
Oh that is very good to hear, thanks for doing that.
I had not tested 7.0 yet in production but we always compile inline with mysqlnd. I had assumed they ripped out the mysql_* support out of that?
They actually include the php_mysql source? Or you took it from a previous version?
(stopped using ereg long ago, preg is much faster)
Totally understand on XP 5.6.* being too much work, I might explore learning how to patch it myself later this year or next using your notes.
edit: found the last mysql deletion
https://github.com/php/php-src/tree/PRE_PHP7_EREG_MYSQL_REMOVALS/ext/mysql
so I can put that back into ext/ but now how do I get configure to recoignize --with-mysql again, investigating...
(that's still not going through mysqlnd though is it - do I have to roll back mysqlnd to March 4th to get mysql_* support via mysqlnd?) |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
|
Back to top |
|
_ck_
Joined: 05 Aug 2015 Posts: 3
|
Posted: Thu 06 Aug '15 8:21 Post subject: |
|
|
Thanks for that, makes it easy.
The date and the notes in the package.xml point out it is the exact same version I found on the official php git, March 3rd
Code: |
<date>2015-03-04</date>
<notes>
This is the original MySQL driver, which has been unbundled from a pre-alpha
version of PHP 7.0.
</notes>
|
so on my linux setup it is as easy as
phpize
./configure
make
make install
and add the extension=mysql.so in the php file
super easy
phpinfo shows the php-src github version as
Code: |
Client API version mysqlnd 5.0.12-dev - 20150407
|
I'm still curious if it is possible to bake it right into the php binary so it is a monolith without extensions but I am not sure how to do that like it used to be via --with-mysql=mysqlnd
Ah, found the answer to my own question
Compiling PECL extensions statically into PHP
http://php.net/manual/en/install.pecl.static.php |
|
Back to top |
|
certtone
Joined: 09 Sep 2015 Posts: 1 Location: BE
|
Posted: Thu 10 Sep '15 12:39 Post subject: optimisations with php benchmark script ? |
|
|
Hi,
Can you advise me optimizations for windows 2012 r2 or apache or php?
On two virtuals machine (2012 r2 and Debian) with the same apache and php configuration...
I had very big difference in results.
I use this script: php script benchmark (http://www.php-benchmark-script.com/)
Via 2012 r2:
--------------------------------------
| PHP BENCHMARK SCRIPT |
--------------------------------------
Start : 2015-09-10 12:34:51
Server : ****
PHP version : 5.6.13
Platform : WINNT
--------------------------------------
test_math : 2.581 sec.
test_stringmanipulation : 3.288 sec.
test_loops : 2.841 sec.
test_ifelse : 1.792 sec.
--------------------------------------
Total time: : 10.502 sec.
With Debian :
--------------------------------------
| PHP BENCHMARK SCRIPT |
--------------------------------------
Start : 2015-09-10 12:36:58
Server : ******
PHP version : 5.6.13
Platform : Linux
--------------------------------------
test_math : 0.987 sec.
test_stringmanipulation : 0.962 sec.
test_loops : 0.669 sec.
test_ifelse : 0.606 sec.
--------------------------------------
Total time: : 3.224 sec.
Someone have package (apache+php) with good results ?
Thanks |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Sun 13 Sep '15 15:15 Post subject: |
|
|
Try running PHP7 nts as mod_fcgid. |
|
Back to top |
|