diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9bbaf8b..01a2891 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 922c4df..7db27ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/docker/mysql/mysql-low-memory.cnf b/docker/mysql/mysql-low-memory.cnf new file mode 100644 index 0000000..986c962 --- /dev/null +++ b/docker/mysql/mysql-low-memory.cnf @@ -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 \ No newline at end of file