MySQL consuming all system memory on INSERT ... SELECT

Posted by siete on Server Fault See other posts from Server Fault or by siete
Published on 2013-10-24T08:22:21Z Indexed on 2013/10/24 9:58 UTC
Read the original article Hit count: 261

Filed under:
|
|
|
|

The mysql daemon is getting killed because Linux is reaching out of memory:

Oct 24 07:41:23 <hostname> kernel: [82297.673701] Out of memory: kill process 13816 (mysqld) score 1839626 or a child

There is a link with some workaround on this.

That only happen when executing a query INSERT ... SELECT with a very huge resulset.

MySQLTuner script displays that maximum theorical memory is less than 8GB, but top and munim shows that is getting over all RAM and swap available:

[--] Total buffers: 560.0M global + 72.2M per thread (100 max threads)
[OK] Maximum possible memory usage: 7.6G (43% of installed RAM)

I'm tried to tune some options with not results, there are the relevant ones:

skip-locking
max_connections         = 100
key_buffer_size         = 512M
max_allowed_packet      = 32M
table_open_cache        = 2000
open_files_limit        = 3000
sort_buffer_size        = 16M
read_buffer_size        = 16M
read_rnd_buffer_size    = 8M
myisam_sort_buffer_size = 64M
thread_cache_size       = 4
query_cache_size        = 16M
query_cache_limit       = 2M
thread_concurrency      = 4
join_buffer_size        = 32M
tmp_table_size          = 32M
max_heap_table_size     = 32M
query_cache_limit       = 8M
bulk_insert_buffer_size = 64M
myisam_max_sort_file_size = 50GB
myisam_mmap_size        = 10GB

And there is a system resume:

  • OS: Linux Debian "Squeeze" 6.0.8 (upgraded yesterday)
  • RAM: 18GB
  • Swap: 18GB
  • MySQL: 5.1.72-2 (official Debain release)

At this moment, update or change OS or MySQL version is not possible, there is any option that can help and i missed?

Sorry by my english, and thank you in advance!

Edit: I'm only using MyISAM tables, and cannot change to InnoDB.

© Server Fault or respective owner

Related posts about linux

Related posts about mysql