As Axel mentioned in his E-mail, there is performance regression between 10.0.4 and 10.0.5:
Date: Thu, 21 Nov 2013 18:32:45 +0100
|
From: Axel Schwenke <axel@askmonty.org>
|
To: "maria-developers@lists.launchpad.net" <maria-developers@lists.launchpad.net>
|
Subject: [Maria-developers] MariaDB-10.0-beta sysbench results
|
Looking for this regression I can see clear performance drop with the following revision:
revno: 3427.1.258
|
revision-id: knielsen@knielsen-hq.org-20130823120213-pbhsq4zc1h3jwa0i
|
parent: knielsen@knielsen-hq.org-20130823081643-f3yhupp15yw9cpy4
|
committer: knielsen@knielsen-hq.org
|
branch nick: work-10.0-mdev26
|
timestamp: Fri 2013-08-23 14:02:13 +0200
|
message:
|
MDEV-26: Global transaction ID.
|
|
Implement @@gtid_binlog_state. This is the internal state of the binlog
|
(most recent GTID logged for every domain_id and server_id). This allows
|
to save the state before RESET MASTER and restore it afterwards.
|
Specifically sys_vars.cc part:
static unsigned char opt_gtid_binlog_state_dummy;
|
static Sys_var_gtid_binlog_state Sys_gtid_binlog_state(
|
"gtid_binlog_state",
|
"The internal GTID state of the binlog, used to keep track of all "
|
"GTIDs ever logged to the binlog.",
|
GLOBAL_VAR(opt_gtid_binlog_state_dummy), NO_CMD_LINE);
|
If I comment it out, I get nice performance boost. Note that it doesn't seem to have anything to do with gtid functionality accessed by Sys_var_gtid_binlog_state methods: I removed all references to gtid code and still observe performance degradation.
It seem to be somehow caused by increase of system variables. If I add new system variable (on revision 3816), I can see performance degradation:
static ulong table_cache_instances1;
|
static Sys_var_ulong Sys_table_cache_instances1(
|
"table_open_cache_instances1",
|
"MySQL 5.6 compatible option. Not used or needed in MariaDB",
|
READ_ONLY GLOBAL_VAR(table_cache_instances1), CMD_LINE(REQUIRED_ARG),
|
VALID_RANGE(1, 64), DEFAULT(1),
|
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
|
ON_UPDATE(NULL), NULL);
|
The difference is like:
64 threads, time spent: 60s, queries executed: 9326530, qps: 155442, 1 thread qps: 2428
vs
64 threads, time spent: 60s, queries executed: 9879031, qps: 164650, 1 thread qps: 2572
I was unable to reproduce performance boost with fresh 10.0 by commenting out gtid_binlog_state.
Even simpler patch for revision 3816 to see performance degradation:
=== modified file 'sql/sys_vars.cc'
|
--- sql/sys_vars.cc 2013-08-14 08:48:50 +0000
|
+++ sql/sys_vars.cc 2013-12-14 18:24:15 +0000
|
@@ -2694,6 +2694,8 @@
|
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
|
ON_UPDATE(NULL), NULL);
|
|
+char buf[sizeof(Sys_table_cache_instances)];
|
+
|
static Sys_var_ulong Sys_thread_cache_size(
|
"thread_cache_size",
|
"How many threads we should keep in a cache for reuse",
|
|
- is duplicated by
-
MDEV-5388
Reduce usage of LOCK_open: unused_tables
-
-
Closed
{"report":{"fcp":909.9000000059605,"ttfb":255.40000000596046,"pageVisibility":"visible","entityId":28224,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"bb20e201-83dd-4286-9b08-cc3842b8b839","navigationType":0,"readyForUser":1004.5,"redirectCount":0,"resourceLoadedEnd":626.5,"resourceLoadedStart":264.69999998807907,"resourceTiming":[{"duration":16.200000017881393,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":264.69999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":264.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":280.90000000596046,"responseStart":0,"secureConnectionStart":0},{"duration":17.900000005960464,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":265,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":265,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":282.90000000596046,"responseStart":0,"secureConnectionStart":0},{"duration":196.80000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":265.2999999821186,"connectEnd":265.2999999821186,"connectStart":265.2999999821186,"domainLookupEnd":265.2999999821186,"domainLookupStart":265.2999999821186,"fetchStart":265.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":287.2999999821186,"responseEnd":462.09999999403954,"responseStart":301.5,"secureConnectionStart":265.2999999821186},{"duration":360.7000000178814,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":265.7999999821186,"connectEnd":265.7999999821186,"connectStart":265.7999999821186,"domainLookupEnd":265.7999999821186,"domainLookupStart":265.7999999821186,"fetchStart":265.7999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":287.5,"responseEnd":626.5,"responseStart":309.40000000596046,"secureConnectionStart":265.7999999821186},{"duration":43.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":266,"connectEnd":266,"connectStart":266,"domainLookupEnd":266,"domainLookupStart":266,"fetchStart":266,"redirectEnd":0,"redirectStart":0,"requestStart":287.69999998807907,"responseEnd":309.19999998807907,"responseStart":306,"secureConnectionStart":266},{"duration":37.400000005960464,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":266.19999998807907,"connectEnd":266.19999998807907,"connectStart":266.19999998807907,"domainLookupEnd":266.19999998807907,"domainLookupStart":266.19999998807907,"fetchStart":266.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":288.59999999403954,"responseEnd":303.59999999403954,"responseStart":302.19999998807907,"secureConnectionStart":266.19999998807907},{"duration":44.400000005960464,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":266.2999999821186,"connectEnd":266.2999999821186,"connectStart":266.2999999821186,"domainLookupEnd":266.2999999821186,"domainLookupStart":266.2999999821186,"fetchStart":266.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":288.69999998807907,"responseEnd":310.69999998807907,"responseStart":307.09999999403954,"secureConnectionStart":266.2999999821186},{"duration":20.299999982118607,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":266.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":266.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":286.7999999821186,"responseStart":0,"secureConnectionStart":0},{"duration":44.400000005960464,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":266.59999999403954,"connectEnd":266.59999999403954,"connectStart":266.59999999403954,"domainLookupEnd":266.59999999403954,"domainLookupStart":266.59999999403954,"fetchStart":266.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":289.7999999821186,"responseEnd":311,"responseStart":307.90000000596046,"secureConnectionStart":266.59999999403954},{"duration":20.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":266.69999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":266.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":287.19999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":46.29999998211861,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":266.90000000596046,"connectEnd":266.90000000596046,"connectStart":266.90000000596046,"domainLookupEnd":266.90000000596046,"domainLookupStart":266.90000000596046,"fetchStart":266.90000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":293.5,"responseEnd":313.19999998807907,"responseStart":311.09999999403954,"secureConnectionStart":266.90000000596046},{"duration":301.2000000178814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":272.7999999821186,"connectEnd":272.7999999821186,"connectStart":272.7999999821186,"domainLookupEnd":272.7999999821186,"domainLookupStart":272.7999999821186,"fetchStart":272.7999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":393.90000000596046,"responseEnd":574,"responseStart":565.1999999880791,"secureConnectionStart":272.7999999821186},{"duration":301.40000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":273.09999999403954,"connectEnd":273.09999999403954,"connectStart":273.09999999403954,"domainLookupEnd":273.09999999403954,"domainLookupStart":273.09999999403954,"fetchStart":273.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":404.40000000596046,"responseEnd":574.5,"responseStart":568,"secureConnectionStart":273.09999999403954},{"duration":137.30000001192093,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":602.6999999880791,"connectEnd":602.6999999880791,"connectStart":602.6999999880791,"domainLookupEnd":602.6999999880791,"domainLookupStart":602.6999999880791,"fetchStart":602.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":706.2999999821186,"responseEnd":740,"responseStart":739,"secureConnectionStart":602.6999999880791},{"duration":265.2999999821186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":844,"connectEnd":844,"connectStart":844,"domainLookupEnd":844,"domainLookupStart":844,"fetchStart":844,"redirectEnd":0,"redirectStart":0,"requestStart":1078.9000000059605,"responseEnd":1109.2999999821186,"responseStart":1108.699999988079,"secureConnectionStart":844}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":78,"responseStart":255,"responseEnd":272,"domLoading":259,"domInteractive":1117,"domContentLoadedEventStart":1118,"domContentLoadedEventEnd":1173,"domComplete":1592,"loadEventStart":1592,"loadEventEnd":1592,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1090.4000000059605},{"name":"bigPipe.sidebar-id.end","time":1091.2999999821186},{"name":"bigPipe.activity-panel-pipe-id.start","time":1091.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1092.9000000059605},{"name":"activityTabFullyLoaded","time":1187.4000000059605}],"measures":[],"correlationId":"95291886314c7c","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
When we add new system variable (e.g. ptr= 0x1061d40, size= 208), addresses of other global C++ variables may change. Among other things address of LOCK_open and unused_tables changes.
rev.3816 (fast):
LOCK_open: 0x1074120, size= 48 (cache line starts 0x1074100)
unused_tables: 0x1074150, size= 8 (cache line starts 0x1074140)
rev.3816 + "char buf[sizeof(Sys_table_cache_instances)]" (slow):
LOCK_open: 0x1074200, size= 48 (cache line starts 0x1074200)
unused_tables: 0x1074230, size= 8 (cache line starts 0x1074200)
Note that in fast version LOCK_open resides on 2 cache lines (32 bytes on first + 16 bytes on second). Second cache line is shared with unused_tables. But since these last 16 bytes are quite static, there should be no false sharing issues.
In slow version LOCK_open resides on 1 cache line which is shared with unused_tables.
oprofile proves that LLC_MISSES increase in slow version:
3816 (fast)
CPU: Intel Sandy Bridge microarchitecture, speed 2.701e+06 MHz (estimated)
Counted LLC_MISSES events (Last level cache demand requests from this core that missed the LLC) with a unit mask of 0x41 (No unit mask) count 10000
samples % image name symbol name
43387 37.4148 no-vmlinux /no-vmlinux
21919 18.9019 libpthread-2.15.so pthread_mutex_lock
6986 6.0244 libpthread-2.15.so pthread_mutex_unlock
5427 4.6800 mysqld tc_release_table(TABLE*)
3741 3.2261 mysqld TABLE::init(THD*, TABLE_LIST*)
3168 2.7319 mysqld tdc_acquire_share(THD*, char const*, char const*, char const*, unsigned int, unsigned int, TABLE**)
3014 2.5991 mysqld open_tables(THD*, TABLE_LIST*, unsigned int, unsigned int, Prelocking_strategy*)
2199 1.8963 libpthread-2.15.so pthread_rwlock_unlock
2151 1.8549 libpthread-2.15.so __lll_lock_wait
2134 1.8403 mysqld dispatch_command(enum_server_command, THD*, char*, unsigned int)
3816 (slow)
CPU: Intel Sandy Bridge microarchitecture, speed 2.701e+06 MHz (estimated)
Counted LLC_MISSES events (Last level cache demand requests from this core that missed the LLC) with a unit mask of 0x41 (No unit mask) count 10000
samples % image name symbol name
43059 39.1488 no-vmlinux /no-vmlinux
20065 18.2429 libpthread-2.15.so pthread_mutex_lock
5736 5.2151 mysqld tc_release_table(TABLE*)
5633 5.1215 libpthread-2.15.so pthread_mutex_unlock
3331 3.0285 mysqld TABLE::init(THD*, TABLE_LIST*)
2913 2.6485 mysqld open_tables(THD*, TABLE_LIST*, unsigned int, unsigned int, Prelocking_strategy*)
2666 2.4239 mysqld tdc_acquire_share(THD*, char const*, char const*, char const*, unsigned int, unsigned int, TABLE**)
2198 1.9984 libpthread-2.15.so pthread_rwlock_unlock
1998 1.8166 libpthread-2.15.so __lll_lock_wait
1976 1.7966 mysqld dispatch_command(enum_server_command, THD*, char*, unsigned int)
3816 (slow + padding)
CPU: Intel Sandy Bridge microarchitecture, speed 2.701e+06 MHz (estimated)
Counted LLC_MISSES events (Last level cache demand requests from this core that missed the LLC) with a unit mask of 0x41 (No unit mask) count 10000
samples % image name symbol name
43144 37.7159 no-vmlinux /no-vmlinux
21324 18.6412 libpthread-2.15.so pthread_mutex_lock
5930 5.1839 libpthread-2.15.so pthread_mutex_unlock
5889 5.1481 mysqld tc_release_table(TABLE*)
3678 3.2153 mysqld TABLE::init(THD*, TABLE_LIST*)
3469 3.0326 mysqld tdc_acquire_share(THD*, char const*, char const*, char const*, unsigned int, unsigned int, TABLE**)
3221 2.8158 mysqld open_tables(THD*, TABLE_LIST*, unsigned int, unsigned int, Prelocking_strategy*)
2418 2.1138 libpthread-2.15.so pthread_rwlock_unlock
2165 1.8926 mysqld dispatch_command(enum_server_command, THD*, char*, unsigned int)
2144 1.8743 libpthread-2.15.so __lll_lock_wait
Adding dummy padding around LOCK_open restore performance:
+char pada[1024];
mysql_mutex_t LOCK_open;
+char padb[1024];