IIS 7 w/ PHP Fast CGI running slow.RSS

5 replies

Last post May 27, 2011 11:04 AM by HCamper

  • IIS 7 w/ PHP Fast CGI running slow.

    Apr 24, 2011 03:16 PM|leonardoturtle|LINK

    Currently two of our sites on our server is extremely bogged down. The wait period when I request a page is on average 30+ seconds. We have over 10+ sites on the same web server. Our site that isn't getting any traffic responds normally. Under 7 seconds.

    Let me list out the configuration of our server before I go into detail.

    Web Server: IIS7
    OS: Windows Server 2008
    Processor Core i3 CPU @ 3.07 GHZ
    RAM: 4 GB
    PHP Version: 5.2.14
    Mysql Server Version: 5 (run on same machine)
    Wincache is installed
    FastCGI Maxinstances is set to 0 to dynamically manage the processes in the process pool


    Is there any way to speed up the response of this server? Or is the only best solution is upgrading our server?

    multiple sites running slow phP slow performance slow iis 7 with fast cgi running slow

  • Re: IIS 7 w/ PHP Fast CGI running slow.

    Apr 25, 2011 07:49 AM|abadincrotch|LINK

    1) Are all service packs/updates/hotfixes installed?

    2) Are you running 2008 x64? Are you running this as a 32-bit app pool?

    3) i3 CPU is simply not a server-class processor. I would hardly even rely on that as a development machine for more than 2-3 people, much less a production server. I would also wonder about disk performance.

    4) If the machine using TCP offloading?

    5) What does memory usage look like? Do you have an app pool for each site, are they shared, etc.? If running x64, I'd add more RAM.

    6) You can try enabling multiple threads for the app pool worker process, as long as your code doesn't display any node affinity -- if you're not relying on local session state or similar on the server, you can use multiple threads. It's like a mini web farm on a single server, using more threads to maximize the value of multi-cores.

     7) If you haven't already, consider using the compression features of IIS to improve content compression. Also, consider caching strategies.

    Microsoft Community Contributor

    MCTS: Service Communication Applications
  • Re: IIS 7 w/ PHP Fast CGI running slow.

    Apr 25, 2011 11:33 AM|HCamper|LINK

    Hello,

    Could you provide more information for "Currently two of our sites on our server is extremely bogged down.".

    What kind of code or operations are at the "sites on our server that are bogged down"?

    If the code is mostly PHP:

    A) For the PHP installation is it the Non-Thread Safe Version ?

    B) You may improve operation for PHP by upgrading to latest version.

       There have been security updates / engine updates / code fixes since the version 5.2.14 was released.

    C) I suggest you check the PHP for Windows site and download the latest release for PHP Engine non-thread-safe version.

         You can save time when updating PHP engine by copying  current php.ini,pear.ini files to safe location

                before install of latested PHP installer.

              You then can use the saved ini file settings to speed up the installation post configuration and testing. 

    D) There have been recent updates to Wincache Extension that may have impact for performance.

           I suggest you get latest developer release for Wincache at the Source Forge current dev release is 1.2.

    If you clarify what your code is doing would be of help.

    Martin

     

     

    Windows and Linux work Together IT-Pros
    Community Member Award 2011
  • Re: IIS 7 w/ PHP Fast CGI running slow.

    Apr 25, 2011 02:32 PM|leonardoturtle|LINK

    1) I have service pack 2 and I just recently did a full update.

    2) Running a 32-bit app pool

     4) I am not familiar with TCP offloading so I am assuming that is a no.  If you can point me to some good references I will do my research on that.

     5) Memory usages is at a safe zone.  40-60% of 4 GB memory usage.  CPU is running very high 90-100%.

    6)  I will look into enabling multiple threads but at the current state of my system running at 100% I think it will break the system.

      Currently, I have the fast-cgi maximum instances set at 0 where it will automatically decide the optimal number for me.  BUT once I set this it seems to create many sql connections that mysql server cannot handle.  About 30% of the time connecting to the site I get a "Can't connect to SQL" message. 

     Also I am considering on changing my mysql engine to Innob instead of MyISAM.  My thinking is the locking of tables when updating could be a reason of the bottleneck. 

    Thank you for the guidance.  If you can shed anymore light on this matter it would be great!

  • Re: IIS 7 w/ PHP Fast CGI running slow.

    Apr 25, 2011 02:45 PM|leonardoturtle|LINK

     Hello Martin,

     <br>

    Thanks for replying to my thread. 

    <br>

    The code is mainly PHP and I am running a separate application pool for each site.  Pretty much all my sites are the same.  Duplicates to be exact.  

    <br><br>

    I am running a non-thread safe version.  My logic in choosing this version that the thread version is presumably "unsafe".  Hence, the name.  Are you having a good experience with the Thread version??  

     <br> <br>

     What Im trying to figure out is why one site is really slow and another is really fast.  They all are using the same php script and connecting to the same database.  So I dont think my database or php code is the issue.  It has to be the IIS Server and my system which is really poor to be using in a production environment.  

    <br><br>

    My guess is it comes down to the application pool for the particular site.  One site is getting heavy traffic.  At peak times on average of 1k visitors.  I updated the fast-cgi module to automatically handle maximum instances but when I set that 20% of the time a request can't connect to the mysql server.  This is a big issue.  I increased the number of maximum concurrent connections on my mysql server from 100 to 120 but still getting the same problem.

     <br> <br>

    Does anybody know a way around this?

     

     

  • Re: IIS 7 w/ PHP Fast CGI running slow.

    May 27, 2011 11:04 AM|HCamper|LINK

    Hello,

    If your still having issues with FastCGI and PHP check this http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/ 

    Guide and look at changing / tweaking Execution Time and or Memory Limits.

    You also might check the buffer size for MySQL Server and InnoDB

    the IIS Net Forums has a recent post http://forums.iis.net/t/1178301.aspx

    with this issue.

    Martin  

     

    Windows and Linux work Together IT-Pros
    Community Member Award 2011