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