简体   繁体   English

如何在全球范围内使用 Amazon EC2 中的最小延迟?

[英]How to use the minimum latency in Amazon EC2 around the globe?

We have few websites that are going to store and serve up a decent amount of data and MySQL queries in EC2 to a global audience where latency should be minimized.我们很少有网站会在 EC2 中向全球受众存储和提供大量数据和 MySQL 查询,从而最大限度地减少延迟。

I am currently in Europe, so the websites latency are around 80ms, as the instance region is in Europe/Ireland.我目前在欧洲,因此网站延迟约为 80 毫秒,因为实例区域位于欧洲/爱尔兰。

But when I load the website from USA, the latency increases to 300ms, I wonder, how we can set up a system in Amazon that will load the website with the fastest way possible but around the world?但是当我从美国加载网站时,延迟增加到 300 毫秒,我想知道,我们如何在亚马逊设置一个系统,以最快的方式加载网站,但在世界范围内? I am not talking about images or files, I am talking about a complete website.我不是在谈论图像或文件,我在谈论一个完整的网站。

Thanks谢谢

A few rules of thumb:一些经验法则:

  • Keep your database as close as possible to your application (same region)使您的数据库尽可能靠近您的应用程序(同一区域)
  • Offload as much as possible from your application/web servers by serving static data via Amazon S3 and/or Amazon CloudFront (eg images, style sheets, javascript includes)通过 Amazon S3 和/或 Amazon CloudFront(例如图像、样式表、javascript 包括)提供静态数据,尽可能多地从您的应用程序/网络服务器卸载
  • If speed is critical, cache data where possible to reduce database queries (eg use ElasticCache, or similar, in front of a database)如果速度很重要,请尽可能缓存数据以减少数据库查询(例如,在数据库前使用 ElasticCache 或类似工具)

Most of the time taken to render a web page isn't the response time to receive the HTML page from the web server, it's normally the additional files used to populate the page, such as images, style sheets and scripts.呈现网页所花费的大部分时间不是从 Web 服务器接收 HTML 页面的响应时间,它通常是用于填充页面的附加文件,例如图像、样式表和脚本。

Therefore, you could then run the application out of one region.因此,您可以在一个区域之外运行该应用程序。 Speeding up the other content through CloudFront will provide a much faster experience for the user, since that content will be served closer to the user.通过 CloudFront 加速其他内容将为用户提供更快的体验,因为该内容将更接近用户。

Once you have that operational, spend some time measuring what is taking time to serve the website.一旦你有了这个操作,花一些时间来衡量什么需要时间来服务网站。 Identify what is taking the longest time, then concentrate on reducing that element.确定什么花费的时间最长,然后集中精力减少该元素。

This will be much easier than going multi-region immediately, which would involve a lot of technical overhead for possibly little gain.这将比立即进入多区域要容易得多,这将涉及大量的技术开销,但收益可能很小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM