I load backup to mariadb and break it. In processlist still present one killed thread:
{code}
show processlist;
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
{code}
In same time I run strace for mysqld and see many calls to madvise:
{code}
chernomorets, the madvise() system calls are apparently how jemalloc lets the operating system reclaim the memory in free(). I assume that malloc() would allocate private anonymous pages with mmap(). Maybe other memory allocation libraries use munmap() or something else; I have not checked lately.
That InnoDB uses an excessive amount of heap memory allocations is a known problem. Fixing it would require massive changes to the code, and it is not feasible to do in a GA release.
Furthermore, I think that the usefulness of ROW_FORMAT=COMPRESSED is limited. When I designed and implemented it in 2005, data file fragmentation was considered to be an issue, and also FALLOC_FL_PUNCH_HOLE did not exist. With flash-based storage, PAGE_COMPRESSED=YES ought to work work better.
Marko Mäkelä
added a comment - chernomorets , the madvise() system calls are apparently how jemalloc lets the operating system reclaim the memory in free() . I assume that malloc() would allocate private anonymous pages with mmap() . Maybe other memory allocation libraries use munmap() or something else; I have not checked lately.
That InnoDB uses an excessive amount of heap memory allocations is a known problem. Fixing it would require massive changes to the code, and it is not feasible to do in a GA release.
Furthermore, I think that the usefulness of ROW_FORMAT=COMPRESSED is limited. When I designed and implemented it in 2005, data file fragmentation was considered to be an issue, and also FALLOC_FL_PUNCH_HOLE did not exist. With flash-based storage, PAGE_COMPRESSED=YES ought to work work better.
I retitled the bug, because while I consider my implementation of ROW_FORMAT=COMPRESSED in InnoDB obsolete by now, something definitely needs to be done about the frequent memory heap operations in InnoDB.
Marko Mäkelä
added a comment - I retitled the bug, because while I consider my implementation of ROW_FORMAT=COMPRESSED in InnoDB obsolete by now, something definitely needs to be done about the frequent memory heap operations in InnoDB.
In MDEV-32050, some copying of undo log records during transaction rollback, a special case of commit (MDEV-15250) and purge was removed. We will still copy undo log records from the buffer pool to heap during MVCC reads.
Marko Mäkelä
added a comment - In MDEV-32050 , some copying of undo log records during transaction rollback, a special case of commit ( MDEV-15250 ) and purge was removed. We will still copy undo log records from the buffer pool to heap during MVCC reads.
A significant portion of heap memory allocation operations during this test, which is inserting data into empty tables is originating from the internal SQL interpreter in InnoDB, which is used for updating persistent statistics. The above command disables that, as well as the use of SSL, which is another notable source of malloc() calls. There is quite a bit of heap memory allocation going on also outside storage engines, for example related to acquiring metadata locks.
Furthermore, while working on MDEV-29445 I recently learned that MADV_DONTNEED actually requests the memory to be unmapped immediately. For workloads that frequently free and allocate memory, it would seem to make sense to defer the release of memory to the operating system kernel, or to request the operating system to defer the modification of the MMU mappings (MADV_FREE).
Marko Mäkelä
added a comment - For the record, I just quickly checked the following test:
./mtr --rr --skip-ssl --mysqld=--innodb-stats-persistent=0 innodb.insert_into_empty,4k
A significant portion of heap memory allocation operations during this test, which is inserting data into empty tables is originating from the internal SQL interpreter in InnoDB, which is used for updating persistent statistics. The above command disables that, as well as the use of SSL, which is another notable source of malloc() calls. There is quite a bit of heap memory allocation going on also outside storage engines, for example related to acquiring metadata locks.
Furthermore, while working on MDEV-29445 I recently learned that MADV_DONTNEED actually requests the memory to be unmapped immediately. For workloads that frequently free and allocate memory, it would seem to make sense to defer the release of memory to the operating system kernel, or to request the operating system to defer the modification of the MMU mappings ( MADV_FREE ).
People
Marko Mäkelä
Sergey Chernomorets
Votes:
0Vote for this issue
Watchers:
6Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1444.1000003814697,"ttfb":370.2000002861023,"pageVisibility":"visible","entityId":64739,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"14a6b422-0267-416e-8599-07875f0a9294","navigationType":0,"readyForUser":1607.4000000953674,"redirectCount":0,"resourceLoadedEnd":940.5,"resourceLoadedStart":379.80000019073486,"resourceTiming":[{"duration":17.199999809265137,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":379.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":379.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":397,"responseStart":0,"secureConnectionStart":0},{"duration":21.199999809265137,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":380.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":380.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":401.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":390,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":380.30000019073486,"connectEnd":380.30000019073486,"connectStart":380.30000019073486,"domainLookupEnd":380.30000019073486,"domainLookupStart":380.30000019073486,"fetchStart":380.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":408,"responseEnd":770.3000001907349,"responseStart":469.40000009536743,"secureConnectionStart":380.30000019073486},{"duration":560,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":380.5,"connectEnd":380.5,"connectStart":380.5,"domainLookupEnd":380.5,"domainLookupStart":380.5,"fetchStart":380.5,"redirectEnd":0,"redirectStart":0,"requestStart":412.90000009536743,"responseEnd":940.5,"responseStart":488.90000009536743,"secureConnectionStart":380.5},{"duration":26.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":380.6000003814697,"connectEnd":380.6000003814697,"connectStart":380.6000003814697,"domainLookupEnd":380.6000003814697,"domainLookupStart":380.6000003814697,"fetchStart":380.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":380.6000003814697,"responseEnd":407.1000003814697,"responseStart":407.1000003814697,"secureConnectionStart":380.6000003814697},{"duration":30,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":380.7000002861023,"connectEnd":380.7000002861023,"connectStart":380.7000002861023,"domainLookupEnd":380.7000002861023,"domainLookupStart":380.7000002861023,"fetchStart":380.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":380.7000002861023,"responseEnd":410.7000002861023,"responseStart":410.7000002861023,"secureConnectionStart":380.7000002861023},{"duration":32.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":381,"connectEnd":381,"connectStart":381,"domainLookupEnd":381,"domainLookupStart":381,"fetchStart":381,"redirectEnd":0,"redirectStart":0,"requestStart":381,"responseEnd":413.30000019073486,"responseStart":413.30000019073486,"secureConnectionStart":381},{"duration":34,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":381.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":381.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":415.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":38.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":381.30000019073486,"connectEnd":381.30000019073486,"connectStart":381.30000019073486,"domainLookupEnd":381.30000019073486,"domainLookupStart":381.30000019073486,"fetchStart":381.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":381.30000019073486,"responseEnd":419.40000009536743,"responseStart":419.40000009536743,"secureConnectionStart":381.30000019073486},{"duration":76.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":381.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":381.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":458.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":38.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":381.7000002861023,"connectEnd":381.7000002861023,"connectStart":381.7000002861023,"domainLookupEnd":381.7000002861023,"domainLookupStart":381.7000002861023,"fetchStart":381.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":381.7000002861023,"responseEnd":420.2000002861023,"responseStart":420.2000002861023,"secureConnectionStart":381.7000002861023},{"duration":149.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":404.40000009536743,"connectEnd":404.40000009536743,"connectStart":404.40000009536743,"domainLookupEnd":404.40000009536743,"domainLookupStart":404.40000009536743,"fetchStart":404.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":404.40000009536743,"responseEnd":554.1000003814697,"responseStart":554.1000003814697,"secureConnectionStart":404.40000009536743},{"duration":181.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":404.5,"connectEnd":404.5,"connectStart":404.5,"domainLookupEnd":404.5,"domainLookupStart":404.5,"fetchStart":404.5,"redirectEnd":0,"redirectStart":0,"requestStart":404.5,"responseEnd":586,"responseStart":586,"secureConnectionStart":404.5},{"duration":72.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":930.9000000953674,"connectEnd":930.9000000953674,"connectStart":930.9000000953674,"domainLookupEnd":930.9000000953674,"domainLookupStart":930.9000000953674,"fetchStart":930.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":967.2000002861023,"responseEnd":1003.4000000953674,"responseStart":1002.9000000953674,"secureConnectionStart":930.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":31,"responseStart":370,"responseEnd":403,"domLoading":375,"domInteractive":1811,"domContentLoadedEventStart":1811,"domContentLoadedEventEnd":1883,"domComplete":2313,"loadEventStart":2313,"loadEventEnd":2314,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1744.2000002861023},{"name":"bigPipe.sidebar-id.end","time":1745.1000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":1745.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":1747},{"name":"activityTabFullyLoaded","time":1907.3000001907349}],"measures":[],"correlationId":"54f106e7e46817","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":160,"dbReadsTimeInMs":17,"dbConnsTimeInMs":27,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
chernomorets, the madvise() system calls are apparently how jemalloc lets the operating system reclaim the memory in free(). I assume that malloc() would allocate private anonymous pages with mmap(). Maybe other memory allocation libraries use munmap() or something else; I have not checked lately.
That InnoDB uses an excessive amount of heap memory allocations is a known problem. Fixing it would require massive changes to the code, and it is not feasible to do in a GA release.
Furthermore, I think that the usefulness of ROW_FORMAT=COMPRESSED is limited. When I designed and implemented it in 2005, data file fragmentation was considered to be an issue, and also FALLOC_FL_PUNCH_HOLE did not exist. With flash-based storage, PAGE_COMPRESSED=YES ought to work work better.