亚马逊网络服务微型实例 - 服务器崩溃 [英] Amazon Web Service Micro Instance - Server Crash

查看:354
本文介绍了亚马逊网络服务微型实例 - 服务器崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的是AWS的微实例作为Web服务器的网站,允许用户上传照片。两个问题:

I am currently using an AWS micro instance as a web server for a website that allows users to upload photos. Two questions:

1)当看着我的CloudWatch的指标,我最近注意到CPU峰值,该网站获得流量很少的那一刻,而是成为在这些尖峰完全无法使用。这些尖峰可以持续几个小时,并重置服务器不能消除尖峰。

1) When looking at my CloudWatch metrics, I have recently noticed CPU spikes, the website receives very little traffic at the moment, but becomes utterly unusable during these spikes. These spikes can last several hours and resetting the server does not eliminate the spikes.

2)虽然看似不相关的,每当我发布我的网站在Twitter上的链接,服务器崩溃(即错误建立一个数据库连接)。一旦重新启动Apache和MySQL,网站恢复正常功能。

2) Although seemingly unrelated, whenever I post a link of my website on Twitter, the server crashes (i.e.,Error Establishing a Database Connection). Once restarting Apache and MySQL, the website returns to normal functionality.

我唯一的猜测是,这个问题在某种程度上的缺失与微实例的结果。不幸的是,当我升级到了小实例,该网站实际上是慢,由于事实,即微实例可以有两个EC2计算单位。

My only guess would be that the issue is somehow the result of deficiencies with the micro instance. Unfortunately, when I upgraded to the small instance, the site was actually slower due to fact that the micro instances can have two EC2 compute units.

有什么建议?

推荐答案

如果你想留在AWS(微实例)的自由层,你应该关闭负载尽可能​​地远离你的EC2实例。

If you want to stay in the free tier of AWS (micro instance), you should off load as much as possible away from your EC2 instance.

我会建议你直接上传,而不是通过Web服务器的图像S3(看到一些例子在这里:的 http://aws.amazon.com/articles/1434 )。

I would suggest you to upload the images directly to S3 instead of going through your web server (see some example for it here: http://aws.amazon.com/articles/1434).

S3也可以用来为,而不是你弱的Web服务器大部分的网页(图片,JS,CSS ...)。您也可以在S3中添加这些文件作为原点亚马逊CloudFront的(CDN)分布,以提高应用程序的性能。

S3 can also be used to serve most of your web pages (images, js, css...), instead of your weak web server. You can also add these files in S3 as origin to Amazon CloudFront (CDN) distribution to improve your application performance.

另一项服务,可帮助您在关闭加载工作SQS(简单队列服务)。相反,在线申请用户的工作,你可以按照自己的速度发送一些请求(上载完成的,例如)作为消息SQS和你的读者处理这些消息。这是韩德尔与服务工作的同时几个用户瞬间负载事业的好办法。

Another service that can help you in off loading the work is SQS (Simple Queue Service). Instead of working with online requests from users, you can send some requests (upload done, for example) as a message to SQS and have your reader process these messages on its own pace. This is good way to handel momentary load cause by several users working simultaneously with your service.

另外一个服务是DynamoDB(托管的NoSQL数据库服务)。你可以把你当前MySQL数据和查询的最上dynamoDB。亚马逊DynamoDB还设有免费的一层,你可以享受。

Another service is DynamoDB (managed NoSQL DB service). You can put on dynamoDB most of your current MySQL data and queries. Amazon DynamoDB also has a free tier that you can enjoy.

通过上述的组合,你可以有你的微实例处理剩下的几个动态网页,直到你需要用你的越来越大的成功扩展您的服务。

With the combination of the above, you can have your micro instance handling the few remaining dynamic pages until you need to scale your service with your growing success.

这篇关于亚马逊网络服务微型实例 - 服务器崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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