Thursday, 26 April, 2018
The world is moving to UTF8, MySQL 8.0 has utf8mb4 charset as default
now, but, to be honest, I was pretty surprised how sensible the
"charset" related topic could be.. -- in fact you may easily hit huge
performance overhead just by using an "odd" config settings around your
client/server charset and collation. While to avoid any potential
charset mismatch between client and server, MySQL has from a long time
an excellent option : "skip-character-set-client-handshake" which is
forcing any client connection to be "aligned" with server settings !
(for more details see the ref. manual : https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_character-set-client-handshake)
-- this option is NOT set by default (to leave you a freedom in choose
of charsets used on client and server sides). However, in my sense, it's
still better to align clients according to the server settings to avoid
any potential client misconfig..
As well if you wish to use UTF8, please use "utf8mb4" as first of all it's the most complete for any kind of characters (and probably the only one which makes sense as of today), and second -- the related code was yet more improved in MySQL 8.0 for better efficiency. How much more efficient ? -- let's see from the following test results.
but first of all, the related config setup :
[mysqld] ... character_set_server=utf8mb4 collation_server=utf8mb4_0900_ai_ci skip-character-set-client-handshake sort_buffer_size=512K
NOTE: mind to use a bigger sort buffer for UTF8
The results are obtained with on the same 2S Skylake as in the previously published RO tests with MySQL 8.0 and latin1 and with the same test workloads (just that for latin1 you need to change character_set_server=latin1 and collation_server=latin1_swedish_ci)
So far, here we are :
Sysbench OLTP_RO 10Mx8-tables UTF8mb4 on 2S 48cores-HT Skylake
- MySQL 8.0 is doing up to 40% better than 5.7
- MariaDB 10.3.5 is trying to follow, but not yet there..
Sysbench RO Point-Selects 10Mx8-tables UTF8mb4 on 2S 48cores-HT Skylake
- point-selects workload is much less sensible to UTF8
- 8.0 and 5.7 are getting highest QPS due RO fixes in 5.7
- MariaDB 10.3.5 is going higher than before since adoption of InnoDB 5.7 code
- 5.6 is slower than others because it's 5.6, and has no 5.7 improvements ;-))
Sysbench RO Distinct-Ranges 10Mx8-tables UTF8mb4 on 2S 48cores-HT Skylake
- MySQL 8.0 is doing 30% better than 5.7
- MariaDB is doing so bad here just because it's already doing something bad yet in previous latin1 tests..
Instead of Summary :
- a gentle reminder to PeterZ that MySQL is not "InnoDB only" ;-))
- if you're doing "benchmarKeting" -- very easy to be "the best" by comparing everyone with UTF8, and hide all other regressions and bottlenecks.. ;-))
- so, hope it's obvious why all my following benchmark results will be published with "latin1" only..
Thank You for using MySQL !
Tuesday, 24 April, 2018
Last year we already published our over 2.1M
record with MySQL 8.0 -- it was not yet GA on that moment and the
result was obtained on the server with 4CPU Sockets (4S) Intel Broadwell
v4. We did not plan any improvement in 8.0 for RO related workloads, and
the main target of this test was to ensure there is NO regressions in
the results (yet) comparing to MySQL 5.7 (where the main RO improvements
were delivered). While for MySQL 8.0 we mostly focused our efforts on
lagging WRITE performance in MySQL/InnoDB, and our "target HW" was 2CPU
Sockets servers (2S) -- which is probably the most widely used HW
configuration for todays MySQL Server deployments..
However, not only SW, but also HW is progressing quickly these days ! -- and one of my biggest surprises last time was about Intel Skylake CPU ;-)) -- the following graph is reflecting the difference between similar 2S servers, where one is having the "old" 44cores-HT Broadwell v4, and another the "new" 48cores-HT Skylake CPUs :
the difference is really impressive, specially when you see that just on 32 users load (when CPU is not at all saturated not on 44cores nor 48cores) there is already 50% gain with Skylake ! (and this is about a pure "response time"), and on peak QPS level it's over 1.8M QPS (not far from 80% gain over Brodawell)..
And this results is marking our next milestone in MySQL RO performance on 2S HW ! ;-))
Sysbench RO Point-Selects 10Mx8-tables latin1 on 2S 48cores-HT Skylake
As already mentioned, the main gain is coming from MySQL 5.7 changes, and we're probably just little bit lucky here to see MySQL 8.0 slightly better than 5.7 ;-)) (while as you can see from the chart, it was also a good reason for MariaDB to move to InnoDB 5.7 to match similar gains comparing to InnoDB 5.6)..
So, it's as expected, to not see any difference on mixed OLTP_RO :
Sysbench OLTP_RO 10Mx8-tables latin1 on 2S 48cores-HT Skylake
and what is amazing here is that we're reaching on 2S Skylake now the 1M QPS result that we obtained in the past with MySQL 5.7 on the same 4S Broadwell v4 box (which was not yet upgraded to 96cores on that time).. And it makes me smile now to recall all the discussions with our users mentioning "they will never use anything bigger than 2S server" -- and here we're ! -- its exactly 2S, 48cores "only" box, but pointing on ALL the problems we already investigated on bigger HW and fixed them ON TIME ! ;-)) -- well, there is still a lot of work ahead, so let's hope we'll be "always on time", let's see..
The most "sensible" RO workload for me was always "distinct ranges" in Sysbench, as it's pointing on issues which anyone can have with "group by" or "distinct" queries.. -- which is involving temp memory tables code, and this code was completely rewritten in 8.0 "from scratch" to be finally more simple, "maintainable" and more scalable. But this is not always meaning "as efficient as before" (the most efficient it could be probably if it was re-written on assembler, but again -- who will want to maintain it again ? ;-))
Sysbench RO Distinct-Ranges 10Mx8-tables latin1 on 2S 48cores-HT Skylake
so far, MySQL 8.0 is doing mostly the same as 5.7 here, and it's really good keeping in mind the impact of the changes.. (while further improvements may still be done, as well many old "broken" cases are solved now, etc.)
(but have nothing to say about MariaDB 10.3.5 here)
well, this was about "latin1" RO results, stay tuned, there is more to come ;-))
And Thank You for using MySQL !
P.S. an "attentive reader" may ask himself -- if over 1.8M QPS are reached on 2S Skylake, what QPS level then will be matched on 4S Skylake ??? -- and I'd say you : we don't care ;-)) we know the result will be higher, but we're NOT running after numbers, and there are other more important problems waiting on us to be resolved, rather to show you "yet more good numbers" ;-))
This is just a short reminder about what to keep in mind when you're preparing some MySQL 8.0 performance testing (or any other 8.0 evaluation) and want to do it "with less blood" ;-))
So far, here is the list :
- 8.0 is using UTF8 by default, so if you're expecting to compare apples-to-apples, configure it with "latin1" as it was before to compare to 5.7/5.6/etc. (or configure them all to UTF8 if your target is to compare UTF8)..
- binlog is enabled by default, so mind to switch it OFF if it's not in your target..
- SSL is ON by default (switch it OFF if not your target)
- auto UNDO truncate is ON by default (if you prefer to avoid any periodic spikes in background of flushing activity due UNDO auto truncate, just switch this features OFF (while you'll still be able to involve the same truncate manually whenever you need it))
- there is a new default authentication plugin (and if you want to see your old apps still working with 8.0, just initialize your MySQL instance + use in your config file the old plugin instead (NOTE: you may still switch plugins via ALTER))
- InnoDB doublewrite fix is still NOT part of the published code, so unless your target is to really show how this missed fix is impacting your workload, switch it OFF (but still mind to bombard Sunny with complaining messages about how this fix is important for you ;-))
MySQL 8.0 Server initialization :
to add to your my.conf file before you start your MySQL instance :$ ./bin/mysqld --user=mysql --datadir=./data --initialize-insecure \ --default-authentication-plugin=mysql_native_password
[mysqld] ... ssl=0 default_authentication_plugin=mysql_native_password skip_log_bin=1 character_set_server=latin1 collation_server=latin1_swedish_ci skip-character-set-client-handshake innodb_undo_log_truncate=off innodb_doublewrite=0