I’m actually new on AWS. And I configured 2 EC2 instances.
One for my MongoDB database and an other one for my application.
I’m using pymongo to make the connection. But If send data through instances each time, it takes too much time. I would like to know if it’s possible to have the mongoDB instance as localhost for the application one, using groups or I don’t know, to get better performances.
Or If it is better to put the database on the same instance as my application and get more EBS.
Be sure you know where your performance bottleneck is.
If both instances are in the same Availability Zone, network latency should not be the largest performance issue. In fact if you have instances that are at least large… due to the better NIC… network latency should be a non-issue.
To know for sure, measure your network utilization with a monitoring tool.
If any of your working set (MongoDB documents that are used with any frequency) cannot fit in RAM of the instance, that means you are touching EBS. EBS is very, very slow compared to what MongoDB needs. I measured a single EBS volume using iozone recently and found the EBS volume to be half as fast as my laptop’s rotational hard drive.
You can improve EBS performance substantially by striping multiple EBS volumes into a software RAID configuration.
The bottom line when running MongoDB on AWS is that you need enough RAM to hold the MongoDB documents that you will touch with any frequency.