Compare performance with PHP even MySQL and Oracle database performance
Use PHP even MySQL and Oracle database performance comparison test hardware instructions: Testing is my love machine, configured as follows: CPU: C433 memory: 128M hard disk: Cool fish 2 generation 20G test Software Description: Win32 is used in Windows NT Server4 , sp5, apache 1.3.12, php3.0.15 and php4rc1, mysql 3.22.29, Oracle 8.0.5 Linux Used BluePoint Linux1.0, Apache 1.3.12, PHP4RC1, MYSQL 3.22.32 Test Code Description: Use one Very simple table, MySQL and Oracle are the same, only three fields, the structure is as follows: Mysql table structure: create table board (6) Not null auto_increment, Board_name char (16) Not null , Board_manager char (20), Primary Key (Board_ID)); Oracle's Structure: CREATE TABLE PHP_Oracle. "Board" ("Board_ID" Float, "Board_name" char (16) Not Null, "Board_Manager" char (20)); We only tested the time of INSERT operation, for SELECT, did not test. Because only PHP3 in Win32 can connect to the Oracle database, only the performance of connecting Oracle is connected with PHP3 is tested. After the official version of PHP4, the speed of connecting Oracle with php4 should be improved. And under Linux, because I didn't load Oracle, I only tested mySQL performance. It is said that in Linux, Oracle's performance is good, just unattainable. And we put all the code used for database connections and Oracle to analyze SQL statements, so the test depends only for time spent on SQL operations.
Programs used to test mysql: Php $ dblink = mysql_connect ("localhost", "root", "shh123"); mysql_select_db ("bbs"); $ counter = 1; set_time_limit (300); $ query = "Insert INTO BOARD (Board_name, Board_Manager) Values ('Test', 'Test') "; $ Begin_Time = Time (); for ($ I = 1; $ I <= 10000; $ I ) {mysql_db_query (" bbs ", $ $ Counter ;} $ END_TIME = Time (); mysql_close ($ dblink); Echo "Test DB Speed ...
"; echo "begin time:". $ begin_time. "
"; echo "
end time:" $ end_time. "
"; $ TOTAL = $ END_TIME- $ begin_time; echo "Total Sources:". $ Total;?> Used to test Oracle: PHP $ Handle = Ocilogon ("php_oracle", "php_oracle"); $ counter = 1; set_time_limit (300); $ query = "INSERT INTO BOARD (Board_ID, Board_name, Board_Manager) Values (: Board_ID, 'Test', 'Test' ) "; $ Handle, $ query); OcibindbyName ($ State,": Board_ID ", & $ I, 32); $ begin_time = Time (); for ($ I = 1; $ i <= 1000; $ i ) {Ociexecute ($ 2);} $ END_TIME = Time (); OCIFREESTATEMENT ($ State); OCILOGFF ($ Handle); Echo "Test DB Speed ...
"; "Begin Time: "$ begin_time."
"; Echo"
end time: "$ end_time."
"; $ total = $ END_TIME- $ begin_time; echo" Total Sources: ". $ Total;> Test results: Environment: Win32 Apache php4 mysql Results: 28 seconds Environment: Win32 Apache php3 mysql Results: 34 seconds Environment: Win32 Apache PHP3 Oracle8.0.5 (OCI function) Result: 46 seconds: Linux Apache PHP4