Performance issues when database grows


I’m using mongodb for my first project and it was really working fine, until…

I promoted my website so the database size increased a lot (30k documents before vs 100k now).

Now, every query I make to my database is really slow! (600ms for a simple query vs 20ms before).

Even if I only use index in my match params.

I don’t really know what to do. Do I just need to upgrade my server ? The CPU/RAM look fine, can it be an issue with Read/Write speed ?

I’m currently using a 5$ DigitalOcean droplet to host my website.

Here are some screenshots of the graphs:
Last 6 hours:

Last 24 hours:

The specs of my server are: Shared CPU, 1 vCPU, 1GB RAM, 25 GB SSD, 1GB Transfer.

Even now that the traffic on the website is really slow, the queries still take 600ms to 3000ms:

Thanks a lot if someone has an idea, I’m pretty much lost with all of that.


I can’t edit my post because new users can only add 1 image but I wanted to add that I tried in local with a similar size database (currently 92k documents), and the queries were really fast (about 30ms).

So it should be an hardware issue ?

EDIT: The issue was a missing index. I thought I had created it but no. Sorry for that.

1 Like