Forums
Ok, why is FASTCGI working with this configuration - but some other problems.
This is the following configuration being used on a Server 2003 Webserver
Windows Server 2003 - 32-Bit - Service Pack 2
IIS6
FastCGI handler 7.5.7693.0 (fbl_srv_iis_dev(ksingla).090415-1635) - ActivityTimeout=900 - IdelTimeout=300 - RequestTimeout=90 - InstanceMaxRequests=1000 - MaxInstances=50 - SignalBeforeTerminateSeconds=10 - ExePath= (redactedpathforsecurity)\php\php.exe PHP 4.4.9
eAccelerator 0.9.5.1
URL Scan 3.1
Native Compression Enabled - GZIP (Static: htm, html, css, js, txt - level 9) (Dynamic: php - level 9)
So, this configuration appears to be running and running pretty well. But after some further research it seems as if we should be running a "non thread safe" version of PHP instead of the thread safe PHP 4.4.9 binaries that we currently are running. I cannot seem to find any non-thread safe PHP 4X Windows Binaries and upgrading to PHP 5x (where they offer non-thread safe binaries) is not an option at the moment.
Question here is why is the configuration working when I've read that is shouldn't? Is there something we should be doing differently?
One thing we have noticed is IIS6 is not using the Kernel Mode Cache - See below
Web Service Cache
Current File Cache Memory Usage - 9639
Current Files Cached - 16
File Cache Hits - 93255
File Cache Hits % - 62,315
Kernel: Current URIs Cached - 0
Kernel: Total URIs Cached - 0
Kernel: URI Cache Hits - 0
Kernel: URL Cache HIts % - 0
Maximum FIle Cache Memory Usage - 341276
Total Files Cached - 6409
Thanks in advance!
- Add new comment
- 4628 reads
Hi There,
If you are still using PHP 4.x then you have no choice but to use the Thread-Safe version of PHP, unless of course your choose to compile your own PHP binaries which in my view would be a wasted effort that should be directed at getting your PHP code version 5 compatible. This should not necessarily cause problems as the PHP core has been Thread-Safe for quite some time, it will only really cause you issues if you are using PHP extensions that are not Thread-Safe. There are also substanital perfomance benefits by moving to the PHP NTS binaries, however by using an OpCode cache such as you are a lot of this is negated. I notice you have MaxInstances set to 50. This value should be set to the same number of cores in your system as demonstrated in this article.
IIS kernel mode cache is something quite different, and only really useful for very high traffic sites where content does not differentiate between users (think at least dozens of hits on the same content every minute). The second part here is really quite important as using kernel mode cache on something like a forum site where content is almost certainly individual to the user can result in all sorts of issues. Have a read of this great blog post by David Wang, however I'd suggest you'd be far better off directing your efforts into getting your code PHP 5.x compliant so you are able to take advantage of the performance improvements of the NTS binaries and the WinCache module.
----------------
Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Whole lot of stuff going on there. My suggestion is don't get too bogged down in the detail. Just quickly FastCGI 0.6 was developed by Shane Caraveo almost a decade ago and although it is the basis for the modern day FastCGI developed by the IIS team at Microsoft, the two should not be compared. Unless you have a very specific reason, you should only really be looking at the Windows FastCGI module these days. You are also correct regarding the MaxInstances value, I had forgot that this can now be set to a dynamic value. Still, rule of thumb applies and the MaxInstances being equal to system cores can be used safely (assuming of course the response output dose not exceed the ResponseBufferLimit value which by default is 4MB). Finally (for this portion at least), there really is no benefit in using a web garden when using FastCGI. The advantage of a web garden for PHP on IIS is that it increases concurrency, which when using FastCGI is redundant as uping the MaxInstances value has much the same effect. Web gardens & PHP should not longer be on the table as they were really only effective in specific cases when using the PHP ISAPI module on multi CPU/Core system (search this site for an article on that)
As for Kernel mode caching, have you done any analysis of your IIS log files to determine if it is truly required? That is do you see HTTP requests for a specific item being consistently bombarded (dozens of requests in any 10 second period) in the logs? If not, I strongly recommend you give kernel mode caching a miss as it is something that should be planned and implemented with consideration. Generally speaking this pretty much rules out forum or any highly dynamic content based sites. I urge you to really have a good read of the kernel mode caching link I posted earlier as well as the links coming off that article to get a better idea of what situations are suited for using kernel mode cache.
The mysql_connect() related error will be because the MySQL extension is built into PHP 4 and in PHP 5 you need to enabled it as a PECL extension. Search this site for instructions on how to do this. From what I can see from you site you host forums with semi regular purges of inactive users. The areas I see you best exploring for faster page loads to end users are;
1) Get you PHP apps PHP 5.x compliant and upgrade to at least the latest NTS version of PHP 5.2.x along with the WinCache module (which is an OpCode cache similar to APC & eAccelerator except designed specifically for FastCGI on IIS by Microsoft).
2) Being a forum with semi regular clean outs it should be safe to assume a large portion of your traffic consists of return visitors. Develop yourself a caching policy to maximise the use of client side browser caching (images, js, css and the like) and your interest in kernel mode caching will become all but redundant. Port80 software even make a cool product called CacheRight which takes a lot of the administrative pain out of this task.
3) If after the above users are still experiencing lag in loading times, first examine your logs for the time to last byte (TTLB) value which can be enabled in your IIS logs. Also look at your system resources as if you have a high TTLB with low CPU utilisation you will either have not enough PHP processes or the actual bandwidth to your server is not sufficient. If CPU usage, Memory Pages/Sec and Disk queue length are all off the scale, then your least problematic approach will be to look at upgrading your server. For this I advise getting a fresh OS build and just migrate your data.
----------------
Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster
Thank You very much for the reply. I've got quite a bit to report back, but that will have to wait until next week when I have a bit less on my plate. I did want to report an interesting finding from some testing done over the week.
As I reported in my last post, during some testing of Xcache, I discovered cached items were disappearing as php processes closed out. I saw a post of yours where you reported
****
UPDATE
Unfortunately it seems that xCache is not compatible with the community version of FastCGI for IIS at this stage. Currently xCache only uses the mmap shared memory scheme which is bound to an individual php.exe process and all its child processes. This is so that the xCache cache is shared among all php.exe processes. FastCGI for IIS unfortunatley does not launch extra php.exe procccess as child processes of the original php.exe process as defined by the PHP_FCGI_CHILDREN variable, but rather they are spawned by the worker process (w3wp.exe) which contains the isapi_fcgi.dll module. The effect this has is that the xCache cache is cleared every time a new php.exe process is started, and also that the xCache cache is not shared amongst any of the running php.exe processes.
****
Well during some more testing with Eaccelerator and thread safe PHP 4.4.9 I noticed all the memory reported by eAccelerator as being "allocated" was sitting in the (2) w3wp.exe processes (Still currently testing with a 2 webgarden as it has been more responsive under load). 1/2 the amount of reported allocated memory is sitting in each w3wp.exe process. The FastCGI php.exe processes come and go as expected but the cached items from eAccelerator seem to stay put in the w3wp.exe processes as long as they are not recycled. We cannot recycle the w3wp.exe processes due to the fact that they will crash and generate a Faulting application w3wp.exe, version 6.0.3790.3959, faulting module ntdll.dll, version 5.2.3790.4789 error. As long as the processes are not recycled everything stays pretty stable.
Is this behavior expected or should eAccelerator under this scenario behave as XCache per your post?
Glad you're seeing some results. I can appreciate the frustration of not being able to find the documentation you are looking for or getting the answers you want as quick as you like. It is essential however you keep in mind that everything from the PHP application you are using (PHPBB), to PHP itself and also all the content/replies on IIS-Aid are only possible because skilled people are giving what spare time they do have to help others and as such getting answers in what you might perceive as a timely manner is not always possible. Added to this is the fact PHP4 was discontinued almost 4 years ago, so it shouldn't be that surprising that finding relevant content is hard to come by. Lesson to be learnt is just how important it is to maintain your systems.
Also, I'm not sure how/where you think that there is detail lacking in the responses you've been given here. In your first post you were looking at solutions (kernel mode caching) without doing the necessary investigation to see if it was suited to your issue. I tried to provide advise on why kernel mode caching wasn't suited (with links that included details on how items are inserted into the kernel mode cache) and in my second post along with urging you to have a good read of previously linked content I also very clearly broke a plan of action down into 3 steps, which by your report here you have seen very good results from having just followed the first step of that plan.
---------------
Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster


Location: Melbourne, Australia
Joined: Sep 2003