MongoDB云部署-高TTFB [英] MongoDB Cloud Deployment - High TTFB

查看:55
本文介绍了MongoDB云部署-高TTFB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Node.js + MongoDB中构建仅移动应用程序.我已将服务器部署在AWS AP-Southeast-1 Region 中.

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

由于我是MongoDB的新手,所以我将利用诸如MongoLabs,Compose.IO,MongoDirector之类的云托管服务(进行一些测试).现在,由于Southeast-1 Region中没有共享托管,这些云托管平台正在将我的数据库部署在AWS AP-Southeast-2或US-East-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.

在测试我的API时,我看到TTFB(到第一个字节的时间)约为1-1.5秒的惊人延迟.是因为服务器&数据库托管在不同的区域?除此之外,我的查询花费的时间相对较少.

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.

推荐答案

您真的不想这样做.我敢肯定,您知道ap-southeast-2(悉尼)距离us-east-1(美国东海岸)很远,而且距ap-southeast-1(新加坡)很远-可能是ping时间为100ms +,而在aws区域内,ping时间应小于2ms.

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.

此外,您需要向数据库和从数据库进行数据传输支付更多费用.区域内的EC2数据传输为$ 0.01/GB(如果具有相同的可用区,则为免费),区域之间的数据传输为$ 0.09/GB

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

这篇关于MongoDB云部署-高TTFB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆