Amazon EC 的架构决策:小型实例还是大型实例?
我准备在 Amazon EC2 上启动我们公司的网站,并有一个相当简单的架构问题:我应该为 Web/应用程序层使用一组小型实例,还是一组大型实例?
我意识到这是一个相当广泛的问题。因此,添加一些澄清的细节:
- 我们的应用程序是一个面向公众的电子商务系统。没有发生大量的计算,超出了动态网站的典型计算范围
- 我们的应用程序是用 ASP.NET MVC 编写的
- 数据库位于单独的服务器上
我希望做出一个决定,同时考虑性能和成本这些非常不同的实例类型。有什么想法吗?
I'm about ready to launch our company's web site on Amazon's EC2, and have a fairly simple architectural question: Should I use an array of Small instances for the web / application layer, or an array of Large instances?
This is a fairly broad question, I realize. So to add some clarifying details:
- Our application is a public-facing e-commerce system. Not a tremendous amount of computation happening, beyond what is typical of an dynamic web site
- Our app is written in ASP.NET MVC
- The database is on a separate server
I'm hoping to make a decision that factors in both the performance and cost of these very different instance types. Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个问题很难回答,因为问题不应该是“我应该在什么实例类型上构建我的网站?”而是“我应该如何扩展我的网站?”。
EC2 背后的概念是您可以流畅地扩展网站,而无需重新配置应用程序。在负载均衡器后面拥有一个由小型实例组成的大型集群将使您能够获得更高的可靠性和更均匀的负载,尽管您可以使用较少数量的大型服务器来实现相同的目标(虽然性能良好,但可能不会给您带来很多好处)因项目规模而带来的好处)。
严格来说,前端 Web 服务器不需要太强大。我每月通过 Linode 的一个 20 美元/月的盒子推送 500 万次点击(尽管我已经推送了超过 1500 万次,没有任何问题)。我可以在我的架构上投入更多资金吗?当然,我可以通过添加更多镜像盒来增加冗余,我可以通过在更多数据中心添加镜像盒来提高性能,并且我可以通过添加更多内存和 CPU 来增加我拥有的镜像盒的容量。
我的观点是,如果您有大盒子并且没有充分利用它们,那么您就是在浪费资源。如果您有小盒子并根据您的需要打开和关闭它们,那么您就可以更好地利用您的资源。
至于您指定的架构,您似乎希望在负载均衡器后面获得一些(小型)前端 Web 服务器在线。从小规模开始,并根据您的网站需要启动更多。至于您的数据库,我建议使用更大的中型实例。确保您的数据被推送到 EBS 而不是实例存储本身。添加您复制到的辅助从属数据库服务器也可能是值得的(为了冗余)。
关键是要非常仔细地监控您的资源。在服务器上花费大量资金似乎是合理的,但为未使用的 EC2 实例付费是不明智的。
希望这有帮助!
This question is difficult to answer because the question shouldn't be "what instance type should I built my site on?" but rather "how should i scale my site?".
The concept behind EC2 is that you can fluidly scale a website without needing to reconfigure your application. Having a large cluster of small instances behind a load balancer would enable you to have a higher reliability and more even load, though you could accomplish the same goal with a smaller number of larger servers (which, though performant, might not give you a lot of benefits due to the size of your project).
Strictly speaking, front-end web servers should not need to be powerhouses. I push five million hits a month through a single $20/mon box at Linode (though I've pushed more than 15 million with no problems at all). Could I be investing more in my architecture? Sure, I could increase redundancy by adding more mirror boxes, I could increase performance by adding boxes in more data centers, and I could bulk up the box(es) that I have by adding more memory and CPU.
My point is that if you have large boxes and you're not using them fully, you're wasting your resources. If you have small boxes and switch them on and off to adjust to your needs, you're making better use of your resources.
As for the architecture that you've specified, it looks like you're going to want to get a few (small) front-facing web servers online behind a load balancer. Start small and boot up more as your site calls for it. As for your database, I'd suggest a larger, mid-range instance. Make sure your data is pushed to EBS and not the instance storage itself. It might also be worthwhile to add a secondary slave DB server that you replicate to (for redundancy).
The key is to monitor your resources very carefully. Spending lots of money on servers may seem well-justified, but paying for EC2 instances that go unused is simply unwise.
Hope this helps!
最好的答案是进行一些负载测试,看看什么可以根据您的应用程序提供更好的性能/成本。
EC2 的伟大之处在于,您可以花几个小时快速设置一个测试环境并尝试一下。
一旦您的应用程序投入生产,根据监控实际利用率和使用情况配置文件的需要,更改实例大小对您来说应该不是什么大问题。
The best answer is to do some load testing and see what gives you better performance/$ based on your application.
The great thing about EC2 is that you can quickly setup a test environment for a couple hours and just try it out.
Once your application is in production it shouldn't be a big deal for you to change instance sizes as needed based on monitoring your actual utilization and usage profiles.
我认为您正在强调 EC2 的一大优势...节省资金并在小型实例上运行应用程序。如果您发现没有足够的能力,只能故障转移到更大的实例。
I think you're calling out one of the great benefits of EC2... Save your money and run the app on a small instance. If you find that there's no enough power than just fail-over to a larger instance.