"Notes" InnoDB memory allocation

Source: Internet
Author: User
Tags server memory

Original: http://www.mysqlperformanceblog.com/2006/05/30/innodb-memory-usage/

There are a lot of questions about how InnoDB allocates memory. Here I try to explain how memory is allocated at startup. The important constants are listed first:

Nblocks=innodb number of blocks in buffer pool = innodb_buffer_pool_size/16384

Os_threads = if (innodb_buffer_pool_size >= 1000Mb) = 50000

else if (innodb_buffer_pool_size >= 8Mb) = 10000

else = 1000 (for linux such systems are correct, there is another way of computing for Windows)

So the amount of memory used by the InnoDB:

L INNODB Buffer pool memory

L INNODB additional memory pool size

L INNODB Record buffer size

L Adaptive Hash Index, size = InnoDB buffer pool/64

L system directory hash, size = 6 * InnoDB buffer pool/512

L Synchronous Array (Sync_array) uses memory for synchronization unit utilization, size = Os_threads * 152

L System Event (os_events) memory, also for synchronization unit utilization, size = Os_threads * 216

L system-locked memory, size =5 * 4 * nblocks

So, the final InnoDB formula:

Buffer pool size + buffer record size + additional memory pool size + 812/16384 * Buffer pool size + os_threads * 368
For simplicity: 812/16384 * Buffer pool Size ~ ~ Buffer Pool Size/20

and os_threads*368 = 17.5MB if buffer pool size > 1000MB

= 3.5MB If buffer pool size > 8MB

For example, such as your buffer pool size =1500m, additional memory pool size =20m, record buffer size =8m, then InnoDB allocated memory = 1500M + 20M + 8M + 1500/20m + 17.5M = 1620.5M.

When you plan to take advantage of your server memory, you need to consider the use of additional memory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.