PHP uses the connection pool through JAVA Bridge to improve performance

Source: Internet
Author: User
Original article: hi. baidu. comzhangsillyitem48ee731080ac36cc39cb30ab I have been looking for a connection pool solution, especially after using Oracle: The following points only come from a small benchmark test environment: 1GRAMIntelPentiumD2. 8G (dual-core) OS: Windows XP (Linux machine efficiency)

Http://hi.baidu.com/zhangsilly/item/48ee731080ac36cc39cb30ab I 've been looking for a connection pool solution, especially after using Oracle primarily: The following points only come from a small benchmark test environment: 1g ram Intel Pentium D 2.8G (dual-core) OS: Windows XP (Linux Server efficiency)

Original article: http://hi.baidu.com/zhangsilly/item/48ee731080ac36cc39cb30ab

I have been looking for a connection pool solution, especially after using Oracle

Note: The following points only come from a small amount of benchmark

Test environment:
1G RAM
Intel Pentium D 2.8G (dual-core)
OS: Windows XP (Linux machines should be more efficient, because Linux can use java. so to extend the Connection Bridge and test the Bridge connected by Pure PHP code)
PHP 5.29
MySQL5
Oracle 10g
PHP JavaBridge 5.411
Tomcat 6.018
Java sdks 1.60 update 11

Since I used the Java Bridge, I have been trying to find a connection pool for PHP to solve the current problem (now many things are running on Oracle, PHP and Oracle are really much slower than you think ). It is easy to use the connection pool through the php java Bridge (nonsense, PHP can deal with java through socket and hand over the resources to java for management). The test result is as follows:

For MySQL:
PHP direct connection to MySQL: 1100 ~ 1300 requests/second
PHP connects to MySQL through Java Bridge and DBCP: 250 ~ 300 requests/second

For Oracle:
PHP direct connection: 30 ~ 33 requests/second
PHP connects to Oracle through Java Bridge and DBCP: 120 ~ 135 requests/second

In the above test, we found that if MySQL is used, the database connection pool is really not needed (there are too many links through the Bridge, and the data packaging and unpacking operations are also designed ). If Oracle is used, the database connection pool will be very promising (even if local requests are added, data packaging, unpacking, and other operations are still worthwhile). After using the connection pool, the performance has increased significantly (prepareStatement is not used for soft parsing of pre-compiled statements, all hard code for SQL statements, and poolPreparedStatements buffering is not enabled ).

The database connection pool is directly completed using the built-in DBCP of Tomcat. By default, removeAbandoned = true validationQuery = "select 1 from dual" is added ". To ensure fairness, both direct connection and Bridge execute the SQL statement they want to listen to and complete the same process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.