Issue

There are many settings and circumstances that can affect performance for your web site on IBM i.  One factor that can occasionally cause a severe slow down on your site is running out of threads.  The default setting of 40 threads is usually sufficient, but if there are performance issues with the site, this is one thing you can check.

One symptom of insufficient threads may be missing entries from the access log.  If the access log stops recording access attempts during the period of time when the site is not responsive, this can indicate there were no available threads to process the logging.

IBM i Zend Website freezes or slows down, or PHP stops responding - how to research

Environment

Any supported version of Zend Server for IBM i, running on any supported version of IBM i   

Resolution

Please take a look when the web site performance seems to be slow, to see what your thread usage is. When performance is OK, you may not see a lot of Active Threads, and so will not get the best picture of what needs to be done.

Please go to the IBM Web Administration interface in your browser (the IBM HTTP Server *ADMIN instance needs to be running):

http://<your IBM i IP address>:2001/HTTPAdmin/

Find the ZENDPHP7 (or ZENDSVR6 for versions 6 through 8.5) link under the Manage - All Servers tab, and click it. This should bring you to a page with the heading "Manage Apache server "ZENDPHP7"". On the left, there is a long menu of selections. Almost at the bottom, under Tools (you may need to expand the Tools category), please find and click "Real Time Server Statistics".

On the page that appears, under the General tab, look at Active Threads and Idle Threads. Adding Active and Idle tells the Total threads. The default for Total Threads is 40 (unless it has been changed in CHGHTTPA, see note below). If you have very few idle threads, you may occasionally be running out of threads, which could cause a hang up. You can refresh the screen manually, or set the refresh interval in the Refresh Interval drop down, to watch these statistics for a while and see if the idle threads are very low, or if they ever drop to zero. If so, you can increase the threads using the ThreadsPerChild directive in the Apache configuration to give Apache more threads to work with.  The default can be changed in the Web Admin by going to Advanced -> Settings tab, and adjusting Number of Threads Maximum.

Normally Idle and Active threads add up to the number of threads specified in the ThreadsPerChild, which defaults to 40, but may be set higher.  It is usually not set much higher, and we have never seen it as high as 100.  If your Idle or Active threads show a very high number with more than 5 digits, you may need a PTF from IBM.  Please take a screen shot that shows the numbers. Then restart Apache to get your site working again.  Later, you can share the screen shot with IBM Support for HTTP Server (5770DG1).  


As shipped, IBM HTTP Server specifies 40 threads as the default.  This value can be changed in the CHGHTTPA command.  It is the maximum value for Number of Server Threads (NBRSVR).  The Minimum value is not used anymore, but is retained for backwards compatibility.  If your number of idle threads is not 40, and you do not have the ThreadsPerChild directive set in the Apache configuration, please go to a command line and prompt CHGHTTPA.  Verify that the Maximum value is set to 40.