InnoDB Buffer Pool Size Calculator

Work out innodb_buffer_pool_size from your RAM after the OS, PHP-FPM, Redis and connection buffers take their share. See the memory breakdown and copy a [mysqld] block for MySQL 8.4, 8.0 or MariaDB.

InnoDB 버퍼 풀 크기 계산기

서버 RAM에서 OS·PHP-FPM·Redis·커넥션 버퍼 몫을 빼고 innodb_buffer_pool_size를 계산합니다. 메모리 내역을 확인하고 MySQL 8.4·8.0·MariaDB용 [mysqld] 설정을 바로 복사하세요.

Server

Reserved for other services (MB)

PHP-FPM ≈ pm.max_children × worker size. Dedicated mode sets every service except the OS to 0.

Connections

Recommended buffer pool

1920 MB innodb_buffer_pool_size

innodb_buffer_pool_size
innodb_buffer_pool_instances
Rounding unit (chunk × instances)
Share of total RAM
innodb_dedicated_server would set

Formula

pool = min((RAM − reserved − max_connections × per_conn) × 0.9, RAM × 0.8)
→ round down to a multiple of 128 MB × instances

Memory breakdown

InnoDB buffer pool
Connections
Reserved (OS + PHP-FPM + Redis + web + other)
Total
Left for MySQL global buffers and page cache

my.cnf snippet


        
      

Reverse: RAM needed to cache your InnoDB data

Uses the same reservations and connections as above. Add room for growth.

Measure your InnoDB data size (run in the mysql / mariadb client)

SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 2) AS innodb_gb
FROM information_schema.tables
WHERE engine = 'InnoDB';

More server tools

All VPS & Server tools

How to Use

1. Enter RAM and what else runs

Put in total RAM and the memory of every other service: OS, PHP-FPM (use the PHP-FPM pm.max_children calculator, which reserves this value for MySQL), Redis and the web server. Check real usage with free -m. Tick "dedicated" if the box runs only the database.

2. Set connections

Keep max_connections at 151 unless you raised it. Each connection can allocate sort, join and read buffers plus a thread stack, so the calculator subtracts the worst case before sizing the pool.

3. Copy the [mysqld] block

Pick MySQL 8.4, 8.0 or MariaDB and copy the snippet into a my.cnf include file. The size is already a multiple of chunk size × instances, so MySQL will not silently round it up.

4. Check the hit ratio under load

Run SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%' after a day of traffic. If Innodb_buffer_pool_reads is more than about 1% of read requests, measure your data size and use the reverse calculator.

사용 방법

1. RAM과 함께 도는 서비스 입력

총 RAM과 다른 서비스가 쓰는 메모리를 입력하세요: OS, PHP-FPM(이 값을 MySQL 몫으로 잡는 PHP-FPM pm.max_children 계산기 참고), Redis, 웹 서버. 실제 사용량은 free -m으로 확인합니다. DB만 도는 서버라면 "전용 서버"에 체크하세요.

2. 커넥션 수 설정

max_connections를 바꾼 적이 없다면 151 그대로 두세요. 커넥션마다 sort·join·read 버퍼와 스레드 스택을 잡을 수 있으므로 계산기는 최악의 경우를 먼저 빼고 버퍼 풀을 계산합니다.

3. [mysqld] 블록 복사

MySQL 8.4, 8.0, MariaDB 중 하나를 고르고 설정을 my.cnf include 파일에 붙여넣으세요. 크기가 이미 chunk 크기 × 인스턴스 수의 배수라서 MySQL이 몰래 올려 잡지 않습니다.

4. 부하 상태에서 적중률 확인

하루 정도 트래픽을 받은 뒤 SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%'를 실행하세요. Innodb_buffer_pool_reads가 읽기 요청의 약 1%를 넘으면 데이터 크기를 측정하고 역계산기를 쓰세요.

Frequently Asked Questions

Start from total RAM, subtract what the OS and every other service on the server need (PHP-FPM, Redis, the web server), subtract the per-connection buffers (max_connections × sort, join, read, read_rnd, binlog cache buffers and thread stack), keep about 10% for MySQL's own global buffers, and cap the result at 80% of RAM. Then round down to a multiple of innodb_buffer_pool_chunk_size × innodb_buffer_pool_instances (128 MB × instances by default).
On a shared 4 GB VPS with 512 MB for the OS, 1 GB for PHP-FPM and 151 default connections, the calculator gives 1920M. On a 4 GB server that runs only MySQL, innodb_dedicated_server would set RAM × 0.5 = 2 GB. Using 80% (about 3.2 GB) on a 4 GB box that also runs PHP leaves too little for everything else and risks swapping or the OOM killer.
Only on a large server dedicated to MySQL. The MySQL manual says up to 80% of physical memory is often assigned on a dedicated database server, and MySQL's own innodb_dedicated_server uses 50% for 1–4 GB and 75% above 4 GB. On a small VPS that also runs PHP, Redis or a web server, subtract their memory first. A buffer pool larger than your data plus growth also brings no benefit.
MySQL 8.0 defaults to 8 instances when the buffer pool is 1 GB or more (otherwise 1). MySQL 8.4 uses 1 instance up to 1 GiB, and above that the smaller of half of (pool size ÷ chunk size) and a quarter of the logical CPUs. Each instance should be at least 1 GB, so small servers want 1 or 2. MariaDB 10.5 and later use a single buffer pool: the variable is ignored in 10.5 and removed in 10.6.
Run SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%' under normal load. Innodb_buffer_pool_reads (reads that had to go to disk) divided by Innodb_buffer_pool_read_requests should stay well under 1%. Also compare the pool with your InnoDB data size from information_schema.tables: if the pool already holds all data and indexes, more RAM will not help.

자주 묻는 질문

총 RAM에서 OS와 같은 서버의 다른 서비스(PHP-FPM, Redis, 웹 서버)가 쓰는 메모리를 빼고, 커넥션별 버퍼(max_connections × sort·join·read·read_rnd·binlog cache 버퍼와 스레드 스택)를 뺀 뒤, MySQL 전역 버퍼용으로 약 10%를 남기고 RAM의 80%를 넘지 않게 합니다. 그 값을 innodb_buffer_pool_chunk_size × innodb_buffer_pool_instances(기본 128MB × 인스턴스 수)의 배수로 내림합니다.
OS 512MB, PHP-FPM 1GB, 기본 커넥션 151개인 4GB 공용 VPS라면 계산 결과는 1920M입니다. MySQL만 도는 4GB 서버라면 innodb_dedicated_server가 RAM × 0.5 = 2GB로 잡습니다. PHP도 함께 도는 4GB 서버에 80%(약 3.2GB)를 주면 나머지 서비스가 쓸 메모리가 모자라 스왑이나 OOM killer가 발생할 수 있습니다.
MySQL 전용의 큰 서버에서만 그렇습니다. MySQL 매뉴얼은 전용 DB 서버에서 물리 메모리의 최대 80%를 버퍼 풀에 주는 경우가 많다고 하며, MySQL의 innodb_dedicated_server도 1–4GB에서는 50%, 4GB 초과에서는 75%를 씁니다. PHP·Redis·웹 서버가 함께 도는 작은 VPS라면 그 메모리를 먼저 빼세요. 데이터와 증가분보다 큰 버퍼 풀은 효과가 없습니다.
MySQL 8.0은 버퍼 풀이 1GB 이상이면 기본 8개(아니면 1개)입니다. MySQL 8.4는 1GiB 이하에서 1개, 그 이상에서는 (풀 크기 ÷ chunk 크기)의 절반과 논리 CPU 수의 1/4 중 작은 값입니다. 인스턴스 하나가 최소 1GB는 되는 게 좋으므로 작은 서버는 1–2개가 맞습니다. MariaDB 10.5 이상은 버퍼 풀이 하나뿐이라 이 변수가 10.5에서는 무시되고 10.6에서 제거되었습니다.
평소 부하에서 SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%'를 실행하세요. Innodb_buffer_pool_reads(디스크까지 간 읽기)를 Innodb_buffer_pool_read_requests로 나눈 값이 1%보다 충분히 낮아야 합니다. information_schema.tables로 구한 InnoDB 데이터 크기와도 비교하세요. 버퍼 풀이 이미 데이터와 인덱스를 모두 담고 있다면 RAM을 늘려도 나아지지 않습니다.
Sponsor
Get started on Vultr
Get $300 free credit — valid for 30 days (limited-time offer)
Claim your credit →