[CONC-17] Very Slow Performance Created: 2013-03-14  Updated: 2013-03-20  Resolved: 2013-03-19

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: John Schember Assignee: Georg Richter
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

Kubuntu 12.10 x64



 Description   

The MariaDB Client Library for C is much slower than the MySQL 5.5 client library by an order of a magnitude.

Sysbench was used to test the performance of the two libraries. The same MySQL 5.5 server installation (as installed from the distribution repository) was used for each test. Sysbench was compiled against the Maria and MySQL client libraries. Trunk as of a few days ago and 5.5.29.

MariaDB Client Library for C took 5190.0790s vs MySQL's Client Library 26.5353s. 5K+ seconds vs 26.5 is a huge difference.

Sysbench linked against MariaDB Client Library for C:

$ sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/run/mysqld/mysqld.sock prepare
$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-socket=/var/run/mysqld/mysqld.sock --num-threads=16 --max-requests=100000 run
sysbench 0.4.12:  multi-threaded system evaluation benchmark
 
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 16
 
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 100000
Threads started!
Done.
 
OLTP test statistics:
    queries performed:
        read:                            1400000
        write:                           500000
        other:                           200000
        total:                           2100000
    transactions:                        100000 (19.27 per sec.)
    deadlocks:                           0      (0.00 per sec.)
    read/write requests:                 1900000 (366.08 per sec.)
    other operations:                    200000 (38.54 per sec.)
 
Test execution summary:
    total time:                          5190.0790s
    total number of events:              100000
    total time taken by event execution: 83038.3823
    per-request statistics:
         min:                                159.58ms
         avg:                                830.38ms
         max:                               1611.11ms
         approx.  95 percentile:            1065.49ms
 
Threads fairness:
    events (avg/stddev):           6250.0000/56.96
    execution time (avg/stddev):   5189.8989/0.12

Sysbench linked against MySQL Client Library:

$ sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-socket=/var/run/mysqld/mysqld.sock prepare
$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-socket=/var/run/mysqld/mysqld.sock --num-threads=16 --max-requests=100000 run
sysbench 0.4.12:  multi-threaded system evaluation benchmark
 
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 16
 
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 100000
Threads started!
Done.
 
OLTP test statistics:
    queries performed:
        read:                            1400154
        write:                           500055
        other:                           200022
        total:                           2100231
    transactions:                        100011 (3768.98 per sec.)
    deadlocks:                           0      (0.00 per sec.)
    read/write requests:                 1900209 (71610.69 per sec.)
    other operations:                    200022 (7537.97 per sec.)
 
Test execution summary:
    total time:                          26.5353s
    total number of events:              100011
    total time taken by event execution: 424.0267
    per-request statistics:
         min:                                  1.20ms
         avg:                                  4.24ms
         max:                                 68.41ms
         approx.  95 percentile:               6.36ms
 
Threads fairness:
    events (avg/stddev):           6250.6875/53.61
    execution time (avg/stddev):   26.5017/0.00



 Comments   
Comment by Georg Richter [ 2013-03-19 ]

Neither Axel Schwenke nor me could reproduce such a difference:
In our benchmarks we experienced a difference between 0 and 8%.

Tested against lp:mariadb-native-client rev. 45.

It seems that there is some space for improvement: The memory management in the prepared statement implementation should be reviewed and optimized (Likely we can reduce some malloc/alloc_root stuff).

Comment by John Schember [ 2013-03-19 ]

Did you use sysbench for your testing?

I can run it again later today or tomorrow against rev. 45 and see if there is an improvement over what I was getting previously.

Comment by Georg Richter [ 2013-03-19 ]

Tests were done with sysbench (statically linked)

gcc -pthread -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a /usr/local/mdb_lgpl/lib/mariadb/libmysqlclient.a -lssl -lrt -lm

and

gcc -pthread -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a /usr/local/mariadb-5.5/lib/libmysqlclient.a -lssl -lrt -lm

Comment by John Schember [ 2013-03-20 ]

I'm seeing the ~8 difference you're seeing with rev 45. Looks like debugging was the reason for the slow down.

Generated at Thu Feb 08 03:02:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.