OpenDBX/Comparison

From Linuxnetworks
Jump to: navigation, search

Environment

The test environment consisted of two different machines both running Debian, the database server Debian 3.1 (Sarge) and the test machine Debian testing (Etch) with the latest official packages. The following software was used for the test:

MySQL server
Version 4.1.11a
MySQL client
Version 5.0.22
OpenDBX 
Version 1.1.1
LibDBI 
Version 0.8.1

MySQL was chosen because it is the one most often used and is best supported by both, OpenDBX and LibDBI. In addition it caches results for further queries using the same query string and therefore minimizes the impact of the database to this test.

One machine hosted the database server while the other was responsible for running the test:

Database server 
VIA C3 533MHz, 256MB RAM
Benchmark client 
Pentium M 1.5GHz, 512MB RAM

Both machines were connected by a 100MBit network and they were the only ones attached to the hub.

Settings

All test were done with default settings for the MySQL database - no further optimizations were applied.

Test description

To test the performance of each library (MySQL, OpenDBX, LibDBI) a small C test program was written which establishes a connection to the database server once and performs a basic query 1 000 000 times in a row for each library. Most of the time is spent in the MySQL library, the server and their communication over the network. Differences in speed to the native MySQL implementation will show the overhead of the OpenDBX and LibDBI implementation.

The database contains only one table with one row:

CREATE TABLE odbxtest (
  i8 tinyint,
  i16 smallint,
  i32 int,
  i64 bigint,
  f4 float,
  f8 double,
  string varchar(25)
) CHARACTER SET = utf8
INSERT INTO odbxtest VALUES (
  100, 1000, 100000, 10000000,
  10000.1, 10000000.1, 'first string' )

Applying the correct character set to the table definition is essential. Otherwise LibDBI will convert between different encodings which will lower its performance figures.

Results

Below are the results for each run with the specified library. The values are the duration times in seconds until the test of each library was finished.

Library MySQL native OpenDBX mysql LibDBI mysql
1. run 227 230 251
2. run 227 230 252
3. run 227 229 252

Conclusion

  • The OpenDBX library is almost as fast as the native access to the MySQL library
  • The LibDBI library is ca. 10% slower than the OpenDBX library