Performance tuning Tips around PHP environment

General discussion on Zend Core for IBM System i
Post Reply
hnagao
Posts: 14
Joined: Tue Dec 01, 2009 1:19 am

Performance tuning Tips around PHP environment

Post by hnagao » Tue Dec 22, 2009 4:13 am

Hi,

I'm facing to improve the response time of multiple PHP requests at the same time.

Our goal is to respond less than 2 seconds. I know the performance tuning is dependent on various factors, so it' s very difficult.

Before tuning up at the beginning, Our environment is as follows:
  • System i system feature code:7459
    Processor feature:8952
    Server CPW:1000CPW
    Interactive CPW:1000CPW
    Available memory size:860MB
Under this environment, more than 10 PHP requests at the same time gain approximately over 10 seconds response time.

So, I did as follows:
  • 1. separate the SQL job's pool(prestarted job QSQSRVR in QSYSWRK subsystem) from the shared pool to the
    private pool(100MB/10 activity level)
    2. separate the ZEND subsystem's pool(include PASE apache server jobs)from the shared pool to the private pool
    (50MB/10 activity level)
    3. use FRCA in i5/OS's apache server.
    4. use db2_pconnect instead of db2_connect.
    5. optimize our PHP code(this means the programming technique).
After above, the response time was improved slightly (2-3seconds shorter)
This is anything but our goal.

At last, I did as follows:
  • 1. add 1GB memory.
    2. increase SQL job's private pool up to 400MB.
    3. increase ZEND subsystem's private pool up to 600MB.
After the above, the response time at a single request was very much improved (within 2-3seconds)
But multiple requests occurred at the same time, their response time were increased up to over 5-10 seconds.

My question is how to decrease the response time on the multiple requests at the same time.
Are there anything else to solve this problem?
 
   

darkluke980
Posts: 61
Joined: Sat Mar 28, 2009 8:31 pm
Location: Italy
Contact:

Re: Performance tuning Tips around PHP environment

Post by darkluke980 » Tue Dec 22, 2009 1:25 pm

Hi,

I used this techniques for Web Services:

1) In php.ini: ibm_db2.i5_ignore_userid=1 This default db2 connection will use the ZendCore default NOBODY profile in a Apache:8000 prefork worker job. Use this option if you not need a specific user profile for SQL
2) Change QAQQIINI with IGNORE_DERIVED_INDEX *YES, may improve performance of SQL
3) Create INDEX for improving SQL performances
4) serialize more used small table in txt file at first excetuion time if you are sure they don't change. Next job will read txt. A sort of shared memory!! For example user_table or configuration table.
5) make connection only when you are sure to run SQL or RPG call.

hnagao
Posts: 14
Joined: Tue Dec 01, 2009 1:19 am

Re: Performance tuning Tips around PHP environment

Post by hnagao » Thu Dec 24, 2009 1:00 am

Hi,

Thanks for your response.

I've forgotten to say we have used Zend Framework mainly. But some codes use native PHP db2_connect or DB2_pconnect.
I executed almost all of your suggestion. And then, each performance of SQL's single job with native code came up to my expectation. But when multiple requests with Zend framework and native code occurred, they seem to be stuck as there are any limitations to wait own execution order or so. I think it might be necessary to tune up a native Apache's or a PASE Apache's directives.

Again, my question. Do you know any other tuning about this case.

kgenaidy
Posts: 2
Joined: Tue Dec 29, 2009 3:21 pm

Re: Performance tuning Tips around PHP environment

Post by kgenaidy » Tue Dec 29, 2009 3:55 pm

We also use Zend Framework. At some point ... you may want to consider using Platform (or licensed Zend Server when GA'd). This has given us significant performance improvements due to the caching mechanisms. Framework opens/reads quite a few files for a request and benefits quite a bit. Also ... ZF performance improved somewhere about the 1.7/1.8 series.

darkluke980
Posts: 61
Joined: Sat Mar 28, 2009 8:31 pm
Location: Italy
Contact:

Re: Performance tuning Tips around PHP environment

Post by darkluke980 » Thu Dec 31, 2009 12:15 pm

I don't know what ZF do, but I can tell you that my web services (write in native code) take 0,10 second for first call, then 0,01. The max overload is 20 parallel calls!!
Not bad.

Bye and happy new year.

hnagao
Posts: 14
Joined: Tue Dec 01, 2009 1:19 am

Re: Performance tuning Tips around PHP environment

Post by hnagao » Mon Jan 04, 2010 3:54 am

Hi,

Happy new year and thanks for your response.

I've been using the ZF 1.9 series, and don't want to use the Platform because it's not free.
Now I'm optimizing some problem codes in consuming performance cost, and things are gradually changing for the better.
You may wish my success.

Thanks a lot !

mjdrucker
Posts: 1
Joined: Thu Jan 14, 2010 6:41 pm

Re: Performance tuning Tips around PHP environment

Post by mjdrucker » Thu Jan 14, 2010 6:49 pm

Since this is a HTTP service the connections need to get an activity level, or they wait. This is especially noticeable when a connection initiates additional threads. The best way to understand what is happening here is to use the System i Navigator.

Select "Work Management", "Memory Pools", "Active Pools". Highlight Active Pools and hit F12. Move "Current Threads", "Current Ineligible Threads", and "Maximum Eligible Threads" to the right column. The screen will now show the detailed thread information.

Typically such situations have far more current threads than Maximum eligible threads. This means any new connection will wait. I found this number hard to define based upon concurrent connections, as the application will drive a difference (spawn threads). I suggest monitoring this screen and setting the activity level to exceed the "Current Threads". This has always worked for me.

Regards,
Micheal...

Post Reply