June 13, 2006

MyISAM concurrent insert

Posted by Vadim |

Arjen posted a good note about MyISAM concurrent-insert features, though I should mention concurrent-insert can be cause of
scalablity and peformance problems on SMP boxes, especially on queries processing range-queries. The reason of problems is POSIX read-write locks, which are used to protect key_buffer from concurrent changes and called for each processed row. More info you can get from my UC2006 talk, in short on main platforms (Linux, Solaris, Windows) rw-locks have a bad implementation and too many calls cause waste of CPU in user-space (Solaris) or kernel-space (Linux).

Some results for MyISAM table, query SELECT id FROM sbtest WHERE id BETWEEN N AND N+20000, id – primary key.
Boxes: Sun V40z, Solaris 10, 4 x Dual Core Opteron @ 2.2GHz (8 logical cpu), 16GB of RAM, StorEdge 3310
and Quadxeon, RedHat AS 3, 2.4.21-15.Elsmp, 4 x Intel(R) XEON(TM) MP CPU 2.00GHz, 4GB of RAM, SATA RAID 10
The results in queries per sec (more is better)

threads Quadxeon
with enabled concurrent-insert
Quadxeon
–skip-concurrent-insert
Sun V40z
with enabled concurrent-insert
Sun V40z
–skip-concurrent-insert
1 44.08 64.82 61.06 129.13
2 32.63 123.33 52.63 244.03
4 24.95 176.62 20.03 463.62
8 19.92 206.81 12.34 483.47
16 19.73 208.66 12.3 428.35
32 19.77 212.83 12.25 445.66

So if you are using range-queries and doing INSERT not often than disabling concurrent-insert with –skip-concurrent-insert can improve MyISAM performance.

As I said the reason of bad scalability is rw-locks and currently MySQL developers are working on CPU-depended rw-locks implementstation, this will be available in MySQL 5.1 – 5.2

Quick look at Ubuntu 6.06

Posted by Vadim |

There are a lot of talks around new coming Ubuntu 6.06, so I decided to make quick benchmarks.
I used sysbench 0.4.6 oltp-read-only workload with 1000000 rows against InnoDB and MyISAM tables.
Such workload is CPU-bound and allows to compare CPU / OS if we are using the same version of MySQL.
So I used MySQL 5.0.22 and my box Dual Core Athlon 3800+, 1Gb of RAM.
For comparison I tested the same workload on my primary Suse 10.0.

Here are results (in transactions per sec, more is better):

InnoDB
threads Ubuntu 6.06 Suse 10.0 Suse/ Ubuntu ratio
1 478.66 536.91 1.12
4 870.50 816.27 0.94
16 582.57 639.05 1.10
64 522.04 547.07 1.05
256 344.30 357.09 1.04
MyISAM
threads Ubuntu 6.06 Suse 10.0 Suse / Ubuntu ration
1 466.13 429.89 0.92
4 765.19 863.23 1.13
16 509.32 537.67 1.06
64 495.97 516.00 1.04
256 339.01 346.65 1.02

In general Suse 10.0 looks better, though the difference is not significant.