
version: "3"
services:
  mariadb:
    image: quay.io/mariadb-foundation/mariadb-devel:10.11
    environment:
      - MARIADB_DATABASE=testdb
      - MARIADB_USER=testuser
      - MARIADB_PASSWORD=password
      - MARIADB_RANDOM_ROOT_PASSWORD=1
    command: --innodb-buffer-pool-size=5G
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 3

  sysbench:
    image: perconalab/sysbench
    command: ["sysbench", "/usr/share/sysbench/oltp_read_write.lua", "--time=300", "--mysql-host=mariadb", "--mysql-user=testuser", "--mysql-password=password", "--mysql-db=testdb", "--table-size=10000000", "--tables=30", "--threads=30", "prepare"]
    depends_on:
      mariadb:
        condition: service_healthy
