MongoDB Cloud Deployment - High TTFB

I am building a mobile only application in Node.js + MongoDB. I have deployed my server in the AWS AP-Southeast-1 Region.

Since I am new to MongoDB, I am leveraging cloud hosting services like MongoLabs, Compose.IO, MongoDirector (testing a few out). Now, these cloud hosting platforms are deploying my database in either of the AWS AP-Southeast-2 OR US-East-1 Region due to unavailability of Shared hosting in the Southeast-1 Region.

While testing my APIs, I saw a alarmingly high latency in the form of TTFB (Time to First Byte) of ~ 1-1.5seconds. Is this because of the server & database hosted in different regions? Apart from this, my queries are relatively taking less time.

Awaiting a reply as we're soon to goto Production.

Answers 1

  • You really don't want to do this. As I am sure you are aware ap-southeast-2 (Sydney) is a very long way from us-east-1 (East Coast of the U.S.) and a long way from ap-southeast-1 (Singapore) - probably ping times of 100ms+, whereas within an aws region ping times should be <2ms.

    In addition you will be charged more for data transfer to and from your database. EC2 data transfer within a region is $0.01/GB (free if same AZ), data between regions is $0.09/GB


Related Articles