Score:1

How can I optimize the memory usage of mysql server on ubuntu?

br flag

I have an ubuntu server version 20.04.2 LTS. On it I have installed just mysql version 8.0.25-0ubuntu0.20.04.1

It's a dedicated server so I have my.cnf set up as this:

innodb_dedicated_server = 1
skip_name_resolve       = 1
key_buffer_size         = 16M
myisam-recover-options  = BACKUP
max_binlog_size         = 100M

The server is a vmware VM configured with 10GB RAM, 8 CPU (2 core, 4 sockets).

The problem is this; every now and then (once in a day or every 2 days) mysql crashes saying "out of memory". For example, just a moment ago I checked my free memory with free -m and it was 130. I thought probably is normal because of innodb_dedicated_server. I have run an alter table on a table with 3.5 million rows and that's when it crashed. Probably it did not have enough memory for the alter table?

How can I optimize this? I would like it to use as much memory as possible but I don't want it to crash for an alter table...

Any help? Thanks!

EDIT - log files:

Jul 20 00:08:35 ITMI-PHSE-MYSQL snapd[937]: storehelpers.go:551: cannot refresh: snap has no updates available: "core", "core18", "core20", "lxd"
Jul 20 00:08:35 ITMI-PHSE-MYSQL snapd[937]: autorefresh.go:513: auto-refresh: all snaps are up-to-date
Jul 20 00:09:01 ITMI-PHSE-MYSQL CRON[33080]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 00:17:01 ITMI-PHSE-MYSQL CRON[33096]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 00:39:01 ITMI-PHSE-MYSQL CRON[33125]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 01:09:01 ITMI-PHSE-MYSQL CRON[33159]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 01:17:01 ITMI-PHSE-MYSQL CRON[33175]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 01:38:46 ITMI-PHSE-MYSQL systemd[1]: fwupd.service: Succeeded.
Jul 20 01:39:01 ITMI-PHSE-MYSQL CRON[33216]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 02:09:01 ITMI-PHSE-MYSQL CRON[33255]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 02:17:02 ITMI-PHSE-MYSQL CRON[33269]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 02:39:01 ITMI-PHSE-MYSQL CRON[33293]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 03:09:01 ITMI-PHSE-MYSQL CRON[33327]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 03:10:01 ITMI-PHSE-MYSQL CRON[33330]: (root) CMD (test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r)
Jul 20 03:17:01 ITMI-PHSE-MYSQL CRON[33341]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 03:31:24 ITMI-PHSE-MYSQL systemd[1]: Starting Ubuntu Advantage APT and MOTD Messages...
Jul 20 03:31:26 ITMI-PHSE-MYSQL systemd[1]: ua-messaging.service: Succeeded.
Jul 20 03:31:26 ITMI-PHSE-MYSQL systemd[1]: Finished Ubuntu Advantage APT and MOTD Messages.
Jul 20 03:39:01 ITMI-PHSE-MYSQL CRON[33388]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 04:09:01 ITMI-PHSE-MYSQL CRON[33423]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 04:17:01 ITMI-PHSE-MYSQL CRON[33436]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 04:39:01 ITMI-PHSE-MYSQL CRON[33459]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 05:09:01 ITMI-PHSE-MYSQL CRON[33496]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 05:17:01 ITMI-PHSE-MYSQL CRON[33506]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 05:39:01 ITMI-PHSE-MYSQL CRON[33532]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 06:09:01 ITMI-PHSE-MYSQL CRON[33568]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 06:10:24 ITMI-PHSE-MYSQL systemd[1]: Starting Daily apt upgrade and clean activities...
Jul 20 06:10:28 ITMI-PHSE-MYSQL systemd[1]: apt-daily-upgrade.service: Succeeded.
Jul 20 06:10:28 ITMI-PHSE-MYSQL systemd[1]: Finished Daily apt upgrade and clean activities.
Jul 20 06:17:01 ITMI-PHSE-MYSQL CRON[33675]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 06:25:01 ITMI-PHSE-MYSQL CRON[33688]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
Jul 20 06:39:01 ITMI-PHSE-MYSQL CRON[33782]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 07:09:01 ITMI-PHSE-MYSQL CRON[33826]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 07:17:01 ITMI-PHSE-MYSQL CRON[33842]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 07:39:01 ITMI-PHSE-MYSQL CRON[33868]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 08:09:02 ITMI-PHSE-MYSQL CRON[33940]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 08:17:01 ITMI-PHSE-MYSQL CRON[33961]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 08:39:02 ITMI-PHSE-MYSQL CRON[34011]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 09:09:01 ITMI-PHSE-MYSQL CRON[34089]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 09:17:01 ITMI-PHSE-MYSQL CRON[34132]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 09:17:55 ITMI-PHSE-MYSQL systemd[1]: Started Session 529 of user lorenzo.
Jul 20 09:39:01 ITMI-PHSE-MYSQL CRON[34363]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 09:42:01 ITMI-PHSE-MYSQL CRON[34370]: (root) CMD (   test -x /etc/cron.daily/popularity-contest && /etc/cron.daily/popularity-contest --crond)
Jul 20 10:07:00 ITMI-PHSE-MYSQL systemd[1]: Starting Message of the Day...
Jul 20 10:07:12 ITMI-PHSE-MYSQL 50-motd-news[34482]:  * Super-optimized for small spaces - read how we shrank the memory
Jul 20 10:07:12 ITMI-PHSE-MYSQL 50-motd-news[34482]:    footprint of MicroK8s to make it the smallest full K8s around.
Jul 20 10:07:12 ITMI-PHSE-MYSQL 50-motd-news[34482]:    https://ubuntu.com/blog/microk8s-memory-optimisation
Jul 20 10:07:12 ITMI-PHSE-MYSQL systemd[1]: motd-news.service: Succeeded.
Jul 20 10:07:12 ITMI-PHSE-MYSQL systemd[1]: Finished Message of the Day.
Jul 20 10:09:01 ITMI-PHSE-MYSQL CRON[34503]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 10:17:03 ITMI-PHSE-MYSQL CRON[34525]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jul 20 10:39:02 ITMI-PHSE-MYSQL CRON[34591]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195446] mysqld invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195450] CPU: 2 PID: 34627 Comm: mysqld Not tainted 5.4.0-77-generic #86-Ubuntu
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195451] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 12/12/2018
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195452] Call Trace:
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195460]  dump_stack+0x6d/0x8b
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195464]  dump_header+0x4f/0x1eb
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195467]  oom_kill_process.cold+0xb/0x10
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195470]  out_of_memory.part.0+0x1df/0x3d0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195472]  out_of_memory+0x6d/0xd0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195475]  __alloc_pages_slowpath+0xd5e/0xe50
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195479]  __alloc_pages_nodemask+0x2d0/0x320
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195481]  alloc_pages_current+0x87/0xe0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195484]  __page_cache_alloc+0x72/0x90
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195486]  pagecache_get_page+0xbf/0x300
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195489]  filemap_fault+0x6b2/0xa50
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195492]  ? unlock_page_memcg+0x12/0x20
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195494]  ? page_add_file_rmap+0xff/0x1a0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195497]  ? filemap_map_pages+0x24c/0x380
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195500]  ext4_filemap_fault+0x32/0x50
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195502]  __do_fault+0x3c/0x130
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195505]  do_fault+0x24b/0x640
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195507]  __handle_mm_fault+0x4c5/0x7a0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195509]  handle_mm_fault+0xca/0x200
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195512]  do_user_addr_fault+0x1f9/0x450
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195515]  __do_page_fault+0x58/0x90
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195517]  do_page_fault+0x2c/0xe0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195520]  page_fault+0x34/0x40
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195522] RIP: 0033:0x7ffb5f76afff
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195527] Code: Bad RIP value.
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195528] RSP: 002b:00007ffb0c051ea0 EFLAGS: 00010246
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195530] RAX: 00000000000000a0 RBX: 00007ff8ec513020 RCX: 0000000000000000
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195531] RDX: 0000000000000014 RSI: 00007ffb0c051ef0 RDI: 00007ff8ec00e6b0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195532] RBP: 00007ffb0c051ee0 R08: 00007ff8ec00e6b0 R09: 00007ff8ec00e70c
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195533] R10: 00007ff8ec00e70c R11: 00007ffb0c051e58 R12: 00007ff8ec051e40
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195533] R13: 0000000000000014 R14: 00007ffb0c051ef0 R15: 0000000000000014
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195535] Mem-Info:
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195546] active_anon:2436714 inactive_anon:283 isolated_anon:0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195546]  active_file:185 inactive_file:37 isolated_file:0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195546]  unevictable:4634 dirty:3 writeback:0 unstable:0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195546]  slab_reclaimable:16654 slab_unreclaimable:32409
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195546]  mapped:2438 shmem:696 pagetables:5722 bounce:0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195546]  free:27493 free_pcp:1798 free_cma:0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195549] Node 0 active_anon:9746856kB inactive_anon:1132kB active_file:740kB inactive_file:148kB unevictable:18536kB isolated(anon):0kB isolated(file):0kB mapped:9752kB dirty:12kB writeback:0kB shmem:2784kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195550] Node 0 DMA free:15860kB min:104kB low:128kB high:152kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195554] lowmem_reserve[]: 0 2911 9861 9861 9861
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195557] Node 0 DMA32 free:47248kB min:19920kB low:24900kB high:29880kB active_anon:2927744kB inactive_anon:92kB active_file:444kB inactive_file:0kB unevictable:0kB writepending:4kB present:3129216kB managed:3063680kB mlocked:0kB kernel_stack:952kB pagetables:5864kB bounce:0kB free_pcp:3104kB local_pcp:296kB free_cma:0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195560] lowmem_reserve[]: 0 0 6949 6949 6949
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195562] Node 0 Normal free:46864kB min:47552kB low:59440kB high:71328kB active_anon:6819112kB inactive_anon:1040kB active_file:480kB inactive_file:740kB unevictable:18536kB writepending:8kB present:7340032kB managed:7124380kB mlocked:18536kB kernel_stack:5784kB pagetables:17024kB bounce:0kB free_pcp:4088kB local_pcp:444kB free_cma:0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195566] lowmem_reserve[]: 0 0 0 0 0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195568] Node 0 DMA: 1*4kB (U) 0*8kB 1*16kB (U) 1*32kB (U) 1*64kB (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15860kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195575] Node 0 DMA32: 932*4kB (UE) 697*8kB (UE) 593*16kB (UE) 198*32kB (ME) 210*64kB (UME) 63*128kB (UME) 1*256kB (M) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 46888kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195583] Node 0 Normal: 1338*4kB (UME) 656*8kB (UE) 246*16kB (UE) 128*32kB (UME) 131*64kB (UME) 93*128kB (UME) 14*256kB (UE) 2*512kB (ME) 1*1024kB (M) 1*2048kB (M) 0*4096kB = 46600kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195592] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195593] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195594] 3206 total pagecache pages
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195595] 0 pages in swap cache
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195596] Swap cache stats: add 0, delete 0, find 0/0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195596] Free swap  = 0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195597] Total swap = 0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195598] 2621310 pages RAM
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195599] 0 pages HighMem/MovableOnly
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195599] 70318 pages reserved
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195600] 0 pages cma reserved
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195600] 0 pages hwpoisoned
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195601] Tasks state (memory values in pages):
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195602] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195610] [    567]     0   567    16228      966   139264        0          -250 systemd-journal
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195618] [    598]     0   598     5551     1083    73728        0         -1000 systemd-udevd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195620] [    612]   101   612     4602      820    81920        0             0 systemd-network
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195623] [    827]     0   827    70052     4498    94208        0         -1000 multipathd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195625] [    878]   102   878     5972     1328    86016        0             0 systemd-resolve
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195627] [    879]   100   879    22557      976    77824        0             0 systemd-timesyn
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195629] [    891]     0   891    11885      823    77824        0             0 VGAuthService
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195630] [    892]     0   892    40670      402    77824        0             0 vmtoolsd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195632] [    920]     0   920    59126      490    98304        0             0 accounts-daemon
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195634] [    923]     0   923     1703      577    45056        0             0 cron
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195635] [    924]   105   924     1913      817    61440        0          -900 dbus-daemon
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195637] [    929]     0   929    20492      498    61440        0             0 irqbalance
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195639] [    931]     0   931     7269     2723    90112        0             0 networkd-dispat
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195640] [    932]     0   932     8544     1105   106496        0             0 nmbd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195643] [    935]   103   935    56125      526    81920        0             0 rsyslogd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195645] [    937]     0   937   455043     3781   360448        0          -900 snapd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195647] [    947]     0   947     4207      444    69632        0             0 systemd-logind
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195648] [    951]     0   951      948      500    45056        0             0 atd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195650] [    964]     0   964     1497      626    49152        0             0 login
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195652] [    984]     0   984     3044      889    69632        0         -1000 sshd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195654] [    996]     0   996    26978     2694   110592        0             0 unattended-upgr
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195656] [   1013]     0  1013    58179      213    86016        0             0 polkitd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195658] [   1048]     0  1048    12242     1806   135168        0             0 smbd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195665] [   1063]     0  1063    11686      859   131072        0             0 smbd-notifyd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195666] [   1064]     0  1064    11688      797   131072        0             0 cleanupd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195668] [   1090]     0  1090    12238     1058   131072        0             0 lpqd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195670] [   1355]  1000  1355     4626      653    81920        0             0 systemd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195676] [   1356]  1000  1356    42217      865    94208        0             0 (sd-pam)
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195682] [   1361]  1000  1361     2104      926    57344        0             0 bash
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195684] [   4014]     0  4014    60297      718   102400        0             0 upowerd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195686] [  20666]   110 20666  4128901  2416524 20922368        0             0 mysqld
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195688] [  29379]     0 29379    12332     1183   135168        0             0 smbd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195690] [  34134]     0 34134     3482      849    65536        0             0 sshd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195692] [  34276]  1000 34276     3515      539    69632        0             0 sshd
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195694] [  34277]  1000 34277     2102      935    57344        0             0 bash
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195696] [  34286]     0 34286     2396      706    57344        0             0 sudo
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195698] [  34289]     0 34289     2096      657    53248        0             0 su
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195699] [  34290]     0 34290     1809      460    49152        0             0 bash
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195701] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/mysql.service,task=mysqld,pid=20666,uid=110
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195886] Out of memory: Killed process 20666 (mysqld) total-vm:16515604kB, anon-rss:9666096kB, file-rss:0kB, shmem-rss:0kB, UID:110 pgtables:20432kB oom_score_adj:0
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.658941] oom_reaper: reaped process 20666 (mysqld), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL systemd[1]: mysql.service: Main process exited, code=killed, status=9/KILL
Jul 20 10:40:55 ITMI-PHSE-MYSQL systemd[1]: mysql.service: Failed with result 'signal'.
Jul 20 10:40:55 ITMI-PHSE-MYSQL systemd[1]: mysql.service: Scheduled restart job, restart counter is at 8.
Jul 20 10:40:55 ITMI-PHSE-MYSQL systemd[1]: Stopped MySQL Community Server.
Jul 20 10:40:55 ITMI-PHSE-MYSQL systemd[1]: Starting MySQL Community Server...
Jul 20 10:41:02 ITMI-PHSE-MYSQL systemd[1]: Started MySQL Community Server.
in flag
If your database is so large that it needs more memory, add more memory.
br flag
I could add more memory but I don't think the problem is "more memory". If I set bufferpoolsize = 2G probably do not crash anymore. As I have set innodb_dedicated_server it should be automatic, why is it crashing?
ua flag
What is the value of `innodb_buffer_pool_size`? What other apps are running in the VM? What operation was being performed when it crashed?
br flag
'innodb_buffer_pool_size', '8589934592'. As written in the description it's a dedicated server, in that moment I was doing an alter table
Wilson Hauck avatar
jp flag
Please post last 400 lines of your error log for analysis.
br flag
I have added the log files.
Score:0
jp flag

You may want to reconsider this situation reported in your error log -

Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195596] Free swap  = 0kB
Jul 20 10:40:55 ITMI-PHSE-MYSQL kernel: [597449.195597] Total swap = 0kB

I would recommend 6 GB minimum swap for your OS to avoid OOM.

Better to be slow for some milliseconds or seconds than OOM stopped.

br flag
Thank you for your time. I am not sure regarding how to set 6GB minimum swap, I will investigate and apply it. However I do not understand why is it happening. it's a dedicated machine with just innodb_dedicated_server=1
Wilson Hauck avatar
jp flag
Even a dedicated server can reach Out Of Memory. Consider our Free My Top 4 Global Variable Suggestions.
Wilson Hauck avatar
jp flag
From any browser search request - ubuntu swap space tutorial - for information to assist with creating swap space.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.