MongoDB Cloud Deployment - High TTFB

落爺英雄遲暮 提交于 2021-02-18 18:51:50

问题


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.


回答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



来源:https://stackoverflow.com/questions/29955714/mongodb-cloud-deployment-high-ttfb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!