Skip to content

Commit

Permalink
Merge pull request #26 from saadbruno/reduce-mysql-memory-footprint
Browse files Browse the repository at this point in the history
reduce mysql memory footprint
  • Loading branch information
saadbruno authored Sep 11, 2022
2 parents 524b7b5 + 264ce14 commit 346522c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
image: mysql:8.0.16
env_file: .env
volumes:
- ./docker/mysql/mysql-low-memory.cnf:/etc/mysql/conf.d/mysql-low-memory.cnf:ro
- ./docker/mysql/orct2p.sql:/docker-entrypoint-initdb.d/orct2p.sql:ro
- orct2p-db:/var/lib/mysql
restart: unless-stopped
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ services:
ports:
- "${MYSQL_DEV_PORT}:3306"
volumes:
- ./docker/mysql/mysql-low-memory.cnf:/etc/mysql/conf.d/mysql-low-memory.cnf:ro
- ./docker/mysql/orct2p.sql:/docker-entrypoint-initdb.d/orct2p.sql:ro
- orct2p-db-dev:/var/lib/mysql
env_file: .env
Expand Down
31 changes: 31 additions & 0 deletions docker/mysql/mysql-low-memory.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[mysqld]

# a few settings were taken from http://www.tocker.ca/2014/03/10/configuring-mysql-to-use-minimal-memory.html

innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K
max_connections=10
key_buffer_size=8
thread_cache_size=0
host_cache_size=0
innodb_ft_cache_size=1600000
innodb_ft_total_cache_size=32000000

# per thread or per operation settings
thread_stack=131072
sort_buffer_size=32K
read_buffer_size=8200
read_rnd_buffer_size=8200
max_heap_table_size=16K
tmp_table_size=1K
bulk_insert_buffer_size=0
join_buffer_size=128
net_buffer_length=1K
innodb_sort_buffer_size=64K

#settings that relate to the binary log (if enabled)
binlog_cache_size=4K
binlog_stmt_cache_size=4K

# this one has the biggest impact on memory usage
performance_schema=0

0 comments on commit 346522c

Please sign in to comment.