Improve mongodb performance AWS on AWS ec2 instance

72 views
Skip to first unread message

vikram singh

unread,
Oct 7, 2018, 11:54:55 PM10/7/18
to mongodb-user
I am running a SAAS application where merchants can setup their store, it works with REST api developed in golang. My application is running properly except mongodb server. I got alert notifications that mongodb server usage are high and reached 99%. Although there is not much traffic it happens multiple times in a day.

Setup summary

1.Each merchant has its own database
2.We run crons every 10 minutes to send notification emails for each merchant
3.We run crons to complete bookings for each merchant every 10 minutes


What are ways to improve the server performance ? I am using xlarge aws server

Thanks

Dushyant Bangal

unread,
Oct 8, 2018, 7:53:42 PM10/8/18
to mongodb-user
Have you added any indexes on the collections?
If not, it will scan whole collection for every query you fire on it.

eg. If your notification queries are targeting "orders" collection to find orders for a specific merchant (using merchantId) that have not been confirmed yet (isConfirmed),
You need to create index on "orders" collection. This index should be combination of merchantId and isConfirmed

You can find more about indexing here:
https://docs.mongodb.com/manual/indexes/

Dushyant Bangal

unread,
Oct 9, 2018, 3:12:16 AM10/9/18
to mongodb-user
Also, you have given MongoDB ATLAS a thought? I recently switched from standalon EC2 instance to ATLAS managed,

Its completely managed by mongodb, and you get a secure connection unlike the community version we install with default settings.

To get a hands-on experience, they give you a free instance with 512 MB storage and shared memory and CPU.

You can use my referral URL to signup and get free $25 credits and launch an instance with higher config:
https://mbsy.co/pCmMH

kuadrosx (Jorge Cuadrado)

unread,
Oct 9, 2018, 11:12:21 AM10/9/18
to mongod...@googlegroups.com
If you are using EBS check the IOPs consumption and also check the mongodb's logs to find out which queries are not using indexes.



--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/d4a736dd-4ab4-4302-ad4a-3140fd24eacc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages