Search code examples
mysqldockertestingdocker-composedatabase-performance

How to speed up mysql docker container for tests?


I use docker/docker-compose to run services and tests. One of the services is mysql:

db:
    image: mysql:5.6
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
    expose:
      - "3306"

Is there any way I can optimize the container's speed specifically for tests (e.g. keep everything in memory, etc.) ?


Solution

  • Well, you could run your database in RAM if you have enough space to do so. That might speed things up a bit.

    services:
      db:
        image: mysql:5.6
        environment:
          - MYSQL_ALLOW_EMPTY_PASSWORD=yes
        expose:
          - "3306"
        tmpfs:
          - /var/lib/mysql
    

    Source