I am using a Laravel application with MySql using docker image mysql:8.0
.
When I use the Laravel db:seed command,then mysql container will only manage to insert max 200 rows per minute (each row has just 3 columns, id
, name
, date
).
I am using Ubuntu 18.04 with the following hardware:
Is there any chance that I can configure my MySql settings, so that the docker image will be able to handle more writes per second? Maybe 10,000 per second?
Here is my docker-compose.yml file:
version: '3'
services:
laravel.test:
build:
context: ./docker/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
- redis
- meilisearch
- selenium
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
- './docker/8.0/my.cnf:/etc/mysql/my.cnf'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
retries: 3
timeout: 5s
These are my my.cnf
settings:
innodb_io_capacity = 2000
innodb_read_io_threads = 64
innodb_thread_concurrency = 64
innodb_write_io_threads = 64