[MDEV-18726] INNDOB gets confused when using large pages if pages=1G Created: 2019-02-24 Updated: 2019-03-26 Resolved: 2019-03-18 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.3.12 |
| Fix Version/s: | 10.4.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip orleans | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | contribution, foundation, patch | ||
| Environment: |
Ubuntu |
||
| Issue Links: |
|
||||||||||||
| Description |
|
In older machines, large pages are =2MB, and of you have enough of them, let's say 10G, you may use in my.cnf I have a box ready to show the issue to Elena is she wants to see it. I have seen the issue in many boxes. |
| Comments |
| Comment by Daniel Black [ 2019-02-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
in MDEV-15685 innodb_buffer_pool_chunk_size is the allocation size, except even this is inflated by a bit of "management overhead" (buf_chunk_init) causing the actual allocation consume two lots of innodb_buffer_pool_chunk_size at a minimum with huge pages showing the same behaviour here. Gets even worse with POWER hardware having 16G large pages (as an option). Agree its all a bit of a mess. I think the `buf_chunk_init` should at least include the management overhead of 32M within its size as the first fix. Long term the availability of multiple page types (since 2.6.27) probably should drop `innodb_buffer_pool_chunk_size` and allocate by pages available (though resizing innodb_buffer_pool_size would need to be re-implemented). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-02-28 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've done some x86_64 and Power8 (non-large page) tests by removing in buf_chunk_init. The rest of the calculations in this function seem to adequately account for the removed space. Small test result change in `innodb.innodb` with a different value of innodb_buffer_pool_pages_total (500/493(debug build)) but otherwise passes tests ok.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip orleans [ 2019-02-28 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
if you send me an installer I may test it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-03-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm not sure how to make an installer and don't really have time. The above is the entire list of lines to remove beginning with `-`. I've progress a bit with a use all the large page sizes starting with the largest - https://github.com/grooverdan/mariadb-server/commits/10.4-large-pages-descriptors-in-page. Now requires 3.8+ kernel (which every maintained distro that mariadb release on does). Resizing buffer pool hasn't be implemented to account for these changes (would need to search each chunk and release larger pages first for downsize) - adds to an already complex implementation. Loosely tested by still WIP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip orleans [ 2019-03-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I wonder if somebody can generate an update for the 10.4 branch with these improvements. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-03-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The initial patch is worth testing and would resolve this issue. More extensive patches need to be complete before merged. Recommend watching https://fosdem.org/2019/schedule/event/hugepages_databases/ -misses. If your miss ratio on your workload is low then larger pages may not provide benefit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip orleans [ 2019-03-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
My database has all possible numbers in North America, 17BN plus all associated information. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-03-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Just to highlight the problem, below a 2M chunk size is increased by 2% and when allocating on a 2M large_page_size system, 4M gets allocated per chunk of which only 51% is used.
OS confirms:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is a welcome idea, but there are a couple of minor problems with the implementation, causing mismatch related to innodb_buffer_pool_size. Please address my review comments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ralf Schenk [ 2019-03-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
When husing 1G hugepages with 10.1.38 on Ubuntu I get 32GB of used SHM Memory when declaring innodb_buffer_pool=16G. I think 16GB are wasted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-03-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
rs@databay.de you may be interested in |