[MDEV-17933] slow server status - dict_sys_get_size() Created: 2018-12-07 Updated: 2019-01-25 Resolved: 2019-01-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.1.37 |
| Fix Version/s: | 10.4.2, 10.1.38, 10.2.22, 10.3.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Adam Bambuch | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance, xtradb | ||
| Issue Links: |
|
||||||||
| Description |
|
Hello, On enviroment with 3M tables and MariaDB 10.1.37, "server status;" is painfully slow, it tooks almost 10 seconds to complete query. It's caused by dict_sys_get_size function that was introduced by fix of
|
| Comments |
| Comment by Marko Mäkelä [ 2018-12-08 ] |
|
The fix of We’d better protect such traversal with rw_lock_s_lock(dict_operation_lock) in order to avoid unnecessary blocking of other threads. But that would not reduce the time for the traversal. Another observation is that not all memory allocations by the InnoDB data dictionary cache are being accounted for. One example is foreign key constraints, which were never tracked by dict_sys->size nor by the new function. Another example is virtual column metadata, starting with 10.2. Do we really need to provide inaccurate statistics of memory usage, or could we remove this output altogether? There are better tools for diagnosing memory usage, such as the heap profiler of tcmalloc. |
| Comment by Marko Mäkelä [ 2019-01-22 ] |
|
In XtraDB, the function dict_sys_get_size() is invoked in more places than in InnoDB. We cannot remove it easily. |
| Comment by Marko Mäkelä [ 2019-01-23 ] |
|
In the end, I decided to replace dict_sys_get_size() with a crude estimate that can be computed without holding any mutex. This will affect various output from InnoDB and XtraDB:
|