Hi, I’m trying to run a simple project with nginx, php and mysql on a droplet with 2 vCPU and 2 GB Ram using the Ubuntu-Docker-Image. The project runs on a really cheap host so far and collects about 1.5GB of data in a database so far and I’m trying to migrate this to a docker environment on Digital Ocean. Basically the main (InnoDB) tables are blogs (about 200 entries) and blog_posts (about 200000 entries).
My problem is, that a simple query is awful slow! Its basically like:
SELECT COUNT(p.id) FROM blog_posts AS p
INNER JOIN blogs AS b ON (p.blog_id=b.id)
WHERE b.active=1 AND p.active=1
So, nothing special. All used fields are indexed. On my local MacBook with the same docker-compose.yml the query takes about 400ms. On the droplet it takes more than 9 seconds!
So far i tried:
Nothing made this query noticeable faster. When monitoring the server during those queries neither the CPU nor the RAM or the disk I/O seem to reach the limit. When profiling the query the most time is used during “Send Data” The best configuration so far is mariadb because it caches the query, but without caching or with changing/adding more parameter it is as slow as the other configurations.
I’m running all conatiner with a single docker-compose.yml and each component as a single service using:
The MySql Data is mounted as volume
...
mysql:
...
volumes:
- ./docker/mysql/:/var/lib/mysql
...
So I’m really run out of Ideas! I’m struggling with this for 2 weeks now and really hope that someone can help me to find the bottleneck.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey friend!
That’s rough. I’d like to check and make sure that the hypervisor is performing at it’s best, just to be sure. Can you open a ticket with our support team and reference this post?
Jarland
Hey jarland, Thanks for your answer! I’ve just created a ticket. But I’m pretty sure the problem is created by me, not a problem of the server. Using a few MySQL services on docker does not seem to be a rare configuration. ;)
Hey, it’s me again. It seems like the basic configuration ob MySql and MariaDB is not optimised for performance. I’ve just tweaked some some configuration, e.g. innodb_buffer_pool_size and the performance just got a giant boost. Another really great tool for getting some ideas for optimising ist the mysqltuner.pl script. So, if anybody encounters these problems just take a look at that.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.