Docker Community Forums

Share and learn in the Docker community.

Docker mariadb Performance


(Max2thousand) #1

Hi all,
I’m trying to create a Docker with mariadb but I found a lot of performance issues. In fact the import of a small database request some minutes from the docker container and only few seconds from the host.
I’ve tried also with the /var/lib/mysql mounted as a separate volume or mounting a directory of the host in the docker without any performance increase.
I’m using the “mariadb” 10 official image from the repo, and the docker fs is AUFS which I suppose is the best performing.
By now my workaround is to install mariadb directly on the host and without using docker, but I think that maybe I miss something…
Thanks,
Massimiliano


(Mbertu) #2

Hi Massimiliano, I’ve experienced the same problem with my Mariadb and Mysql containers.

I think that to make this topic useful, more information are needed.
To avoid topic replication I’ll post here my system details…

Docker Info

Containers: 4 Running: 4 Paused: 0 Stopped: 0 Images: 31 Server Version: 1.10.3 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 43 Dirperm1 Supported: true Execution Driver: native-0.2 Logging Driver: json-file Plugins: Volume: local Network: bridge null host Kernel Version: 3.16.0-4-amd64 Operating System: Debian GNU/Linux 8 (jessie) OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 3.865 GiB Name: XXX ID: CJJM:TG2G:KQSZ:BHV6:YPY5:53ET:ORNC:7C6I:JMGK:KWPJ:S3PS:HM4U WARNING: No memory limit support WARNING: No swap limit support WARNING: No oom kill disable support WARNING: No cpu cfs quota support WARNING: No cpu cfs period support
Container Info (3 container are basend on the same image, the 4th is a bit different but only in my.cnf)
[ { "Id": "36cd0f6abba6dd40c6dd790fd7b03b6a93b5a5d2b6954c422defd30994fcd270", "Created": "2016-03-20T21:13:17.426976641Z", "Path": "/docker-entrypoint.sh", "Args": [ "mysqld" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 45847, "ExitCode": 0, "Error": "", "StartedAt": "2016-03-20T21:45:52.822392311Z", "FinishedAt": "2016-03-20T21:45:52.103453087Z" }, "Image": "sha256:a1eef741260ff1484b1f806a86f349ce9364077dd8cd6e9ffc33d41d3fceff8c", "ResolvConfPath": "/var/lib/docker/containers/36cd0f6abba6dd40c6dd790fd7b03b6a93b5a5d2b6954c422defd30994fcd270/resolv.conf", "HostnamePath": "/var/lib/docker/containers/36cd0f6abba6dd40c6dd790fd7b03b6a93b5a5d2b6954c422defd30994fcd270/hostname", "HostsPath": "/var/lib/docker/containers/36cd0f6abba6dd40c6dd790fd7b03b6a93b5a5d2b6954c422defd30994fcd270/hosts", "LogPath": "/var/lib/docker/containers/36cd0f6abba6dd40c6dd790fd7b03b6a93b5a5d2b6954c422defd30994fcd270/36cd0f6abba6dd40c6dd790fd7b03b6a93b5a5d2b6954c422defd30994fcd270-json.log", "Name": "/mysqldockerconfig_maisonremake-db_1", "RestartCount": 0, "Driver": "aufs", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/var/lib/docker/volumes/1ec4bd89556df20f073ef5ac97db5045f11e1e7febee2443c0ab9bb089ca9012/_data:/var/lib/mysql:rw" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": { "max-file": "10", "max-size": "2m" } }, "NetworkMode": "default", "PortBindings": { "3306/tcp": [ { "HostIp": "", "HostPort": "4411" } ] }, "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 }, "VolumeDriver": "", "VolumesFrom": [], "CapAdd": null, "CapDrop": null, "Dns": null, "DnsOptions": null, "DnsSearch": null, "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "ShmSize": 67108864, "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": null, "KernelMemory": 0, "Memory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null }, "GraphDriver": { "Name": "aufs", "Data": null }, "Mounts": [ { "Source": "/var/lib/docker/volumes/1ec4bd89556df20f073ef5ac97db5045f11e1e7febee2443c0ab9bb089ca9012/_data", "Destination": "/var/lib/mysql", "Mode": "rw", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "36cd0f6abba6", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "3306/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "MYSQL_ROOT_PASSWORD=XXX", "MYSQL_PASSWORD=XXX", "MYSQL_USER=XXX", "MYSQL_DATABASE=XXX", "affinity:container==6378e15a42ed7d5eed735265a546957eb3c3b34ea71ac861f99f72371037a262", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "MARIADB_MAJOR=10.1", "MARIADB_VERSION=10.1.12+maria-1~jessie" ], "Cmd": [ "mysqld" ], "Image": "mbertu/mariadb:10-thread", "Volumes": { "/var/lib/mysql": {} }, "WorkingDir": "", "Entrypoint": [ "/docker-entrypoint.sh" ], "OnBuild": null, "Labels": { "com.docker.compose.config-hash": "070b3a37db01f739b65588c2d7274ebc0ac64a04a9aeaf5870d1c81aa1334710", "com.docker.compose.container-number": "1", "com.docker.compose.oneoff": "False", "com.docker.compose.project": "mysqldockerconfig", "com.docker.compose.service": "maisonremake-db", "com.docker.compose.version": "1.5.2" } }, "NetworkSettings": { "Bridge": "", "SandboxID": "753160bbc3e8f60cc038e432035decadd2d6454c94f31596abf44cd1cd512a9c", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "3306/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "4411" } ] }, "SandboxKey": "/var/run/docker/netns/753160bbc3e8", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "96357e5caf7c4f65268bc40e0928d5ae55de086ac1954c7e745d06ae07f55eb8", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "94bf65128f958a74fb99682a88637b6a35a1d811dcba15ac0555fdaddc81a162", "EndpointID": "96357e5caf7c4f65268bc40e0928d5ae55de086ac1954c7e745d06ae07f55eb8", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02" } } } } ]

There is a big performance issue, any query take from 50ms to 200ms even to a simple select of a dozen of entry but the load on the system is very low (cpu and memory).

Free -m
total used free shared buffers cached Mem: 3957 1540 2416 57 185 557 -/+ buffers/cache: 796 3160 Swap: 0 0 0

Neither optimizing the DBMS config or changing the blkio cgrpous for the jbd2 process I’ve catch a small improvement.

Anyone have some idea?


(Xplouder) #3

Hi, @mbertu and @max2thousand, did you find any solution for this?


(Mbertu) #4

Hi @xplouder, for me was the network of my VPS server.
I’ve two VPS on the same network, the first one with php containers for my websites code and the second one with the MariaDB dockers.
My problem was the additional latency due to the network!
Once I’ve found this, I’ve put all together on the same server and the problem is gone!