Skip to content

MariaDB Performance in Docker is Half as Fast Compared to Running Directly on the Host System #629

@justinh998

Description

@justinh998

I initially ran the MariaDB Docker container without any additional options (the container was placed in a Docker network and also received a volume mounted to /var/lib/mysql).

The performance seemed a bit slow to me (3000-4000 q/s when inserting 150000 rows), so I stopped the container and ran MariaDB directly on host (also without any additional options).

For the same 150000 rows, I then had a performance of 7000-8000 q/s.

MariaDB in the Docker container runs at half the speed compared to running directly on the host system.

I also tried to speed up the container with various options, but that didn't help either. Here is my final Docker Compose:

version: '3'
volumes:
  data:
services:
  db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: Sandburg123#
      MYSQL_USER: JUSTINH
      MYSQL_PASSWORD: Sandburg123#
    command: --performance-schema=true --innodb-buffer-pool-size=12884901888 --innodb_log_buffer_size=64M --max_connections=128 --thread_cache_size=32 --tmp_table_size=268435456 --query_cache_size=67108864 --query_cache_type=1 --innodb_flush_method=fsync
    volumes:
      - data:/var/lib/mysql
      #- /var/lib/mysql/socket:/var/run/mysqld
    ports:
      - "3306:3306"
    restart: unless-stopped
    networks:
      - link
networks:
   link:

Does anyone have an idea why MariaDB in Docker is so slow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions