[OJB-developers] Using Mckoi with Ojb and performance measure
Brought to you by:
thma
From: <syl...@be...> - 2002-03-03 10:36:54
|
Hi, I wanted to have a look at the Mckoi pure java rdbms for a while. http://mckoi.com/database/ The recent post about performance of OJB with mysql finally got me started. Mckoi is an open source database with a Gpl Licence and can be an alternative to hsql wich is not very realistic for performance test because hsql keeps its data in RAM. Mckoi can run both in client server mode and in embedded mode. The only difference is the url you use and the fact that you have to start the server or not. Mckoi was very easy to install. Just download it, unzip have a look at the example. Under the Mckoi home directory ( c:\java\mckoi ) I have created a ojb directory for the test. I have copied there a db.conf file from the mckoi test directory and created a new db with the following command. %JAVA_HOME%\bin\java -cp ..\mckoidb.jar;..\gnu-regexp-1.0.8.jar com.mckoi.runtime.McKoiDBMain -conf .\db.conf -create test test I then just started the db in server mode with %JAVA_HOME%\bin\java -cp ..\mckoidb.jar;..\gnu-regexp-1.0.8.jar com.mckoi.runtime.McKoiDBMain -conf .\db.conf to stop the server just use %JAVA_HOME%\bin\java -cp ..\mckoidb.jar;..\gnu-regexp-1.0.8.jar com.mckoi.runtime.McKoiDBMain -shutdown test test I then copied mckoidb.jar to the ojb lib directory and and adapted a few file : swith some comment to go from the client server mode to the embedded mode 1) in the source\test\setup directory I modified the db-setup.sql by just adding these line to the front //#ifdef MCKOI ; for mckoi (OJB default) d com.mckoi.JDBCDriver; o jdbc:mckoi:local://c:\java\mckoi\ojb\db.conf test test ; ; o jdbc:mckoi://127.0.0.127 test test ; //#endif 2) I then had to modify the build.xml file a)in the init target adding <!-- set to -MCKOI to disable the MCKOI specifics in db-setup.sql--> <property name="MCKOI" value="+MCKOI"/> adding mckoi jar to the runtime-classpath <property name="runtime_classpath" value="${classpath}:${build}/test/ojb:${lib}/db2j ava.zip:${lib}/mckoidb.jar:${lib}/hsqldb.jar:${li b}/jta- spec1_0_1.jar:${lib}/junit.jar:${lib}/jaxp.jar:${ lib}/parser.jar:${lib}/xerces.jar:${lib}/antlr.ja r"/> b) changing these line in the tests target !! <echo message="using switches: ${MCKOI}, ${HSQLDB}, ${ORACLE}, ${MS_ACCESS}, ${INSTANTDB}, ${DB2}, ${POSTGRESQL}, ${MYSQL}"/> <java fork="no" classname="org.hsqldb.util.CodeSwitcher" failonerror="true" classpath="${classpath}:${lib}/hsqldb.jar"> <arg value="${source}/test/setup" /> <arg value="${HSQLDB}" /> !! <arg value="${MCKOI}" /> 3) Finaly in the src\test\ojb I modified the repository.xml file to have mckoi as the default <JdbcConnectionDescriptor id="default"> <dbms.name>mckoi</dbms.name> <driver.name>com.mckoi.JDBCDriver</driver.name> <url.protocol>jdbc</url.protocol> <!-- <url.subprotocol>mckoi</url.subprotocol> <url.dbalias>//127.0.0.1</url.dbalias> --> <url.subprotocol>mckoi:local</url.subprotocol> <url.dbalias>//c:/java/mckoi/ojb/db.conf</url.dba lias> <user.name>test</user.name> <user.passwd>test</user.passwd> </JdbcConnectionDescriptor> I then just launched a build performance with Mckoi client server I get [ojb] Time: 827,049 [jdbc] Time: 614,403 diff 209.645 => 25% (see full trace below) with Mckoi embedded I get [ojb] Time: 661.711 [jdbc] Time: 450.758 diff 210.953 => 31% with hsql I get [ojb] Time: 124.138 [jdbc] Time: 76.45 diff 47.688 => 38% My machine is a PIII 700 Mhz windows 2000 java 1.3 (jbuilder) It is probably possible to tweak mckoi configuration file to have better performance, large cache,... The CPU is at 100% during the client server test, both the server and the client run on the same machine (more cpu ,less network overhead) and just below for the embededd test. The overhead between the c/s mode and embedded mode is constant in time ~210.000. What I don't really understand is why it is so high in comparison with hsql (almost 4x) ? Anybody have an idea? Have a nice day Bertrand PS: Thomas could you adapt the build.bat file just a little so that if the JAVA_HOME env variable is already set it keeps it and adding a %1 at the and so that we can pass the target of the build as parameter. @echo off REM Please let JAVA_HOME point to your JDK base directory if "%JAVA_HOME%" == "" set JAVA_HOME=C:\Programme\jdk1.3 set JAVA=%JAVA_HOME%\bin\java set cp= for %%i in (lib\*.jar) do call cp.bat %%i set CP=build\classes;%JAVA_HOME%\lib\tools.jar;%CP% %JAVA% -classpath %CP% -Dant.home=lib org.apache.tools.ant.Main %1 %2 %3 %4 %5 %6 - buildfile build.xml %1 Annexe: Trace Client Server Mode main-opt: [javac] Compiling 20 source files to C:\java\ojb\ojb-0.7.327\build\classes tests: [move] Moving 1 files to C:\java\ojb\ojb- 0.7.327\src\test\setup using switches: +MCKOI, -HSQLDB, -ORACLE, - MS_ACCESS, -INSTANTDB, -DB2, -POSTGRE SQL, -MYSQL . [move] Moving 1 files to C:\java\ojb\ojb- 0.7.327\src\test\setup [copy] Copying 1 files to C:\java\ojb\ojb- 0.7.327\build\test\setup [java] [BOOT] INFO: DB url: jdbc:mckoi://127.0.0.127 [java] [BOOT] INFO: Driver: Mckoi JDBC Driver [java] [BOOT] INFO: Version: 0.70-beta performance: [ojb] [BOOT] INFO: OJB.properties: file:/C:/java/ojb/ojb-0.7.327/build/tes t/ojb/OJB.properties [ojb] .[performance] INFO: [ojb] [performance] INFO: inserting 10000 Objects: 71653 msec [ojb] [performance] INFO: updating 10000 Objects: 87756 msec [ojb] [performance] INFO: querying 10000 Objects: 39978 msec [ojb] [performance] INFO: querying 10000 Objects: 37624 msec [ojb] [performance] INFO: fetching 10000 Objects: 4917 msec [ojb] [performance] INFO: deleting 10000 Objects: 41139 msec [ojb] [performance] INFO: [ojb] [performance] INFO: inserting 10000 Objects: 65184 msec [ojb] [performance] INFO: updating 10000 Objects: 85332 msec [ojb] [performance] INFO: querying 10000 Objects: 39406 msec [ojb] [performance] INFO: querying 10000 Objects: 37825 msec [ojb] [performance] INFO: fetching 10000 Objects: 4937 msec [ojb] [performance] INFO: deleting 10000 Objects: 39967 msec [ojb] [performance] INFO: [ojb] [performance] INFO: inserting 10000 Objects: 66285 msec [ojb] [performance] INFO: updating 10000 Objects: 83841 msec [ojb] [performance] INFO: querying 10000 Objects: 38085 msec [ojb] [performance] INFO: querying 10000 Objects: 37003 msec [ojb] [performance] INFO: fetching 10000 Objects: 4827 msec [ojb] [performance] INFO: deleting 10000 Objects: 40338 msec [ojb] [ojb] Time: 827,049 [ojb] [ojb] OK (1 tests) [ojb] [jdbc] [BOOT] INFO: OJB.properties: file:/C:/java/ojb/ojb-0.7.327/build/tes t/ojb/OJB.properties [jdbc] .[performance] INFO: [jdbc] [performance] INFO: inserting 10000 Objects: 45565 msec [jdbc] [performance] INFO: updating 10000 Objects: 60097 msec [jdbc] [performance] INFO: querying 10000 Objects: 32507 msec [jdbc] [performance] INFO: querying 10000 Objects: 32907 msec [jdbc] [performance] INFO: fetching 10000 Objects: 4086 msec [jdbc] [performance] INFO: deleting 10000 Objects: 30283 msec [jdbc] [performance] INFO: [jdbc] [performance] INFO: inserting 10000 Objects: 42652 msec [jdbc] [performance] INFO: updating 10000 Objects: 61468 msec [jdbc] [performance] INFO: querying 10000 Objects: 31526 msec [jdbc] [performance] INFO: querying 10000 Objects: 32256 msec [jdbc] [performance] INFO: fetching 10000 Objects: 4406 msec [jdbc] [performance] INFO: deleting 10000 Objects: 30074 msec [jdbc] [performance] INFO: [jdbc] [performance] INFO: inserting 10000 Objects: 43702 msec [jdbc] [performance] INFO: updating 10000 Objects: 63412 msec [jdbc] [performance] INFO: querying 10000 Objects: 30954 msec [jdbc] [performance] INFO: querying 10000 Objects: 32707 msec [jdbc] [performance] INFO: fetching 10000 Objects: 3555 msec [jdbc] [performance] INFO: deleting 10000 Objects: 29803 msec [jdbc] [jdbc] Time: 614,403 [jdbc] [jdbc] OK (1 tests) [jdbc] init: prepare: main-opt: [javac] Compiling 20 source files to C:\java\ojb\ojb-0.7.327\build\classes tests: [move] Moving 1 files to C:\java\ojb\ojb- 0.7.327\src\test\setup using switches: +MCKOI, -HSQLDB, -ORACLE, - MS_ACCESS, -INSTANTDB, -DB2, -POSTGRE SQL, -MYSQL . [move] Moving 1 files to C:\java\ojb\ojb- 0.7.327\src\test\setup [copy] Copying 1 files to C:\java\ojb\ojb- 0.7.327\build\test\setup [java] [BOOT] INFO: DB url: jdbc:mckoi://127.0.0.127 [java] [BOOT] INFO: Driver: Mckoi JDBC Driver [java] [BOOT] INFO: Version: 0.70-beta performance: [ojb] [BOOT] INFO: OJB.properties: file:/C:/java/ojb/ojb-0.7.327/build/tes t/ojb/OJB.properties [ojb] .[performance] INFO: [ojb] [performance] INFO: inserting 10000 Objects: 66045 msec [ojb] [performance] INFO: updating 10000 Objects: 84221 msec [ojb] [performance] INFO: querying 10000 Objects: 38706 msec [ojb] [performance] INFO: querying 10000 Objects: 36693 msec [ojb] [performance] INFO: fetching 10000 Objects: 4827 msec [ojb] [performance] INFO: deleting 10000 Objects: 40047 msec [ojb] [performance] INFO: [ojb] [performance] INFO: inserting 10000 Objects: 64683 msec [ojb] [performance] INFO: updating 10000 Objects: 81448 msec [ojb] [performance] INFO: querying 10000 Objects: 36612 msec [ojb] [performance] INFO: querying 10000 Objects: 37374 msec [ojb] [performance] INFO: fetching 10000 Objects: 4556 msec [ojb] [performance] INFO: deleting 10000 Objects: 40749 msec [ojb] [performance] INFO: [ojb] [performance] INFO: inserting 10000 Objects: 64353 msec [ojb] [performance] INFO: updating 10000 Objects: 82829 msec [ojb] [performance] INFO: querying 10000 Objects: 36853 msec [ojb] [performance] INFO: querying 10000 Objects: 38375 msec [ojb] [performance] INFO: fetching 10000 Objects: 4747 msec [ojb] [performance] INFO: deleting 10000 Objects: 40268 msec [ojb] [ojb] Time: 805,008 [ojb] [ojb] OK (1 tests) [ojb] [jdbc] [BOOT] INFO: OJB.properties: file:/C:/java/ojb/ojb-0.7.327/build/tes t/ojb/OJB.properties [jdbc] .[performance] INFO: [jdbc] [performance] INFO: inserting 10000 Objects: 44104 msec [jdbc] [performance] INFO: updating 10000 Objects: 59876 msec [jdbc] [performance] INFO: querying 10000 Objects: 33929 msec [jdbc] [performance] INFO: querying 10000 Objects: 31214 msec [jdbc] [performance] INFO: fetching 10000 Objects: 4337 msec [jdbc] [performance] INFO: deleting 10000 Objects: 29863 msec [jdbc] [performance] INFO: [jdbc] [performance] INFO: inserting 10000 Objects: 43042 msec [jdbc] [performance] INFO: updating 10000 Objects: 60296 msec [jdbc] [performance] INFO: querying 10000 Objects: 31195 msec [jdbc] [performance] INFO: querying 10000 Objects: 31385 msec [jdbc] [performance] INFO: fetching 10000 Objects: 4607 msec [jdbc] [performance] INFO: deleting 10000 Objects: 29703 msec [jdbc] [performance] INFO: [jdbc] [performance] INFO: inserting 10000 Objects: 43412 msec [jdbc] [performance] INFO: updating 10000 Objects: 62470 msec [jdbc] [performance] INFO: querying 10000 Objects: 29673 msec [jdbc] [performance] INFO: querying 10000 Objects: 31335 msec [jdbc] [performance] INFO: fetching 10000 Objects: 3825 msec [jdbc] [performance] INFO: deleting 10000 Objects: 28792 msec [jdbc] [jdbc] Time: 604,81 [jdbc] [jdbc] OK (1 tests) [jdbc] BUILD SUCCESSFUL Total time: 49 minutes 56 seconds Appuyez sur une touche pour continuer... |