Details
-
Task
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
I load backup to mariadb and break it. In processlist still present one killed thread:
{code}
show processlist;
---------------------------------------------------------------------------------------------------------
Id | User | Host | db | Command | Time | State | Info | Progress |
---------------------------------------------------------------------------------------------------------
85 | loader | 10.10.16.216:43971 | phonebook_storage | Killed | 1845 | Unlocking tables | NULL | 0.000 |
184 | root | localhost | NULL | Query | 0 | init | show processlist | 0.000 |
---------------------------------------------------------------------------------------------------------
{code}
In same time I run strace for mysqld and see many calls to madvise:
{code}
- strace -ff -p 33080
...
[pid 60412] madvise(0x7f36cb638000, 331776, MADV_DONTNEED) = 0
[pid 60412] madvise(0x7f36cb441000, 135168, MADV_DONTNEED) = 0
[pid 60412] madvise(0x7f36cb638000, 335872, MADV_DONTNEED) = 0
[pid 60412] madvise(0x7f36cb441000, 135168, MADV_DONTNEED) = 0
[pid 60412] madvise(0x7f36cb638000, 335872, MADV_DONTNEED) = 0
[pid 60412] madvise(0x7f36cb441000, 135168, MADV_DONTNEED) = 0
[pid 60412] madvise(0x7f36cb638000, 335872, MADV_DONTNEED) = 0
{code}
Table which been loading:
{code}
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `contact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_phonebook` int(10) unsigned NOT NULL DEFAULT '0',
`id_user` int(10) unsigned NOT NULL DEFAULT '0',
`firstname` varchar(255) NOT NULL DEFAULT '',
`lastname` varchar(255) NOT NULL DEFAULT '',
`local_key` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `id_phonebook` (`id_phonebook`) USING BTREE,
KEY `id_user` (`id_user`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=133028725 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
/*!40101 SET character_set_client = @saved_cs_client */;
{code}
Attachments
Issue Links
- relates to
-
MDEV-515 innodb bulk insert
-
- Closed
-
-
MDEV-21225 Remove ut_align() and use aligned_malloc()
-
- Closed
-
-
MDEV-32050 UNDO logs still growing for write-intensive workloads
-
- Closed
-
-
MDEV-18746 Reduce the amount of mem_heap_create() or malloc()
-
- Open
-
-
MDEV-30889 Memory leak issues with MariaDB 10.6.12 and OOM Crashes
-
- Confirmed
-
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-29445I 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).