Search Oracle Blogs

List of Blogs maintained by Paweł Barut.


Saturday, October 27, 2007

Testing new OCI8 (1.3.0 beta) for PHP with DRCP Support

I've seen Christopher Jones announcement on availability of beta OCI8 extension for PHP with support for DRCP. I've decided to give it a try. On my test machine running OEL5 I've installed latest PHP 5.4.2 and then replaced OCI8 sources with new OCI8 1.3.0 beta release. I've configured PHP:
./configure --with-oci8=$ORACLE_HOME --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc/httpd/conf --enable-sigchild --without-sqlite --without-mysql
compiled it and installed. Everything went fine, and on sample page I've displayed phpinfo():

I've changed php.ini to enable Database Resident Connection Pooling:
oci8.connection_class="TESTPOOL"
and tested that it is used in PHP.
Then I've decided to test and compare performance of different methods of connection to Oracle from PHP. I've created simple PHP page, that connects to Oracle, execute simple query that returns one row, and inserts one row to another table. I've prepared test script for Apache JMeter against this page.
Test specification:
  • Run on single processor machine
  • Oracle and Apache+PHP run in VMware
  • DRCP setup to have max 4 processes (3 processes effectively used, 4th for authentication only)
  • 6 simultaneous users opening the same web page 200 times
  • 4 versions of PHP script were used:
    1. oci_connect used to connect to Oracle without using DRCP (Database Resident Connection Pooling)– in this case new connection is created for every request from web browser. Connection is then closed at the end of script
    2. oci_pconnect used to connect to Oracle without using DRCP – in this case new connection is created for every apache process that is responding to request from web browser. Connection is then closed at the end of script
    3. oci_connect used to connect to Oracle with using DRCP (Database Resident Connection Pooling)– in this case for every request connection is obtained from pool and given back to pool at the end of script, seems that in this case only process is reused (PURITY=NEW), while session is not (see my observations when using SQL*Plus )
    4. oci_pconnect used to connect to Oracle with using DRCP (Database Resident Connection Pooling)– in this case for every request connection is obtained from pool and given back to pool at the end of script. But in this case full potential of DRCP is used (PURITY=SELF)
Here are the results:
Version Description # Requests Average Median Standard Deviation Throughput
1 oci_connect without DRCP 1200 989 875 828 359
2 oci_pconnect without DRCP 1200 123 94 187 2505
3 oci_connect with DRCP 1200 117 94 115 2907
4 oci_pconnect with DRCP 1200 82 78 30 4060

I must say that I'm positively impressed by performance achieved by version 3 where oci_pconnect with DRCP was used. I expected that performance for version 2,3,4 will be very similar. But I've observed 60% increase in Throughput and 33% shorter response times when comparing version 2 and 4 (oci_pconnect with and without DRCP). I've changed one setting for my test in JMeter: I've turned on Keep-Alive for http transfer and here are the results:
Version Description # Requests Average Median Standard Deviation Throughput
1 oci_connect without DRCP




Not tested
2 oci_pconnect without DRCP 1200 84 63 116 4077
3 oci_connect with DRCP 1200 104 94 45 3265
4 oci_pconnect with DRCP 1200 78 78 23 4396
In this case I've observed less differences on Throughput and Response times between version 2 and 4. This is because with Keep-Alive causes that the same apache processes are used for requests coming from the same web browser. As connection is kept open, reduces time to establish connections between clients (web browsers) to apache server. Thats why we can see higher throughput. Additionally for oci_pconnect without DRCP less amount of sessions are created. Without Keep-Alive apache opened much more sessions, as it had to create more processes and every process had to connect to Oracle. Lets summarize my observations:
  1. oci_pconnect with DRCP works stable in both cases (with and without Keep-Alive) giving maximun throughput and very low standard deviation,
  2. oci_pconnect with DRCP has high standard deviation what means that there are lot of request with response time much higher then average,
  3. In both cases connecting to Oracle with use of DRCP performed better than without.
Next time I'll try to go into extremes to see how DRCP behaves.
Cheers, Paweł

7 comments:

Alex Gorbachev said...

Pawel,
Interesting test. It might be biased by VMware (I recall that I sometimes had nasty overhead during process fork with VMware but I don't have exact details).
I'm looking forward for your next post on that topic. I'm particularly interested in that as DRCP is one of topics I cover during my RAC connection management presentation.
Cheers,
Alex

Paweł Barut said...

Hi Alex,
I've tried to get rid of VMware influences. Before every measured test I've run it once (or) to stabilize environment. And results are repeatable (of course with small deviation).
I hope I've managed to minimize VMware impact on test results.
Of course it would be good to test it on real machine, but I do not have one at this moment.
Pawel

Gena01 said...

Hi Pawel,

A couple of things:
1. The setup that you had with DRCP disabled was it DEDICATED or SHARED server setup?
2. You know that you don't need to recompile ALL of PHP to get oci8 to work.

Paweł Barut said...

Hi Gena,
1. it was using DEDICATED server.
2. it was easier for me to recompile full PHP.

Gena01 said...

Hi Pawel,

Would it be too much of a request to try it with SHARED server setup? Would DRCP enabled matter if you have SHARED setup?

Thank you,

Gena01

Paweł Barut said...

Hi Gena,
What exactly you are interested in? DRCP cannot work as Shared Server. You want to have comparison between Shared Server and DRCP?
I have not much time this week, but I'll try to test soon.

Paweł Barut said...

Hi Gena,

You will find answer to your question in my last post

 

Copyright © Paweł Barut
Printing from DOS to USB Printer