规划可扩展 Web 应用程序的开发

发布于 2024-09-10 09:15:58 字数 899 浏览 7 评论 0原文

我们创建了一个产品,可能会对驻留在我们服务器上的数据文件产生大量请求。目前,我们有一个共享托管服务器,它运行 PHP 脚本来查询数据库并为每个用户请求生成数据文件。这效率不高,而且到目前为止还不是问题,但我们希望迁移到更具可扩展性的系统,因此我们正在考虑 EC2。我们主要关心的是能够在发生大量流量时对其进行处理,并为下载数据文件的用户提供低延迟。

我还不能 100% 确定这一切将如何工作,但这就是想法:

我们使用 EC2 实例来托管我们的管理面板并生成提供给应用程序用户的文件。当任何管理员做出影响这些数据文件(由用户下载)的更改时,我们会使用 CloudFront 将副本复制到 S3。这里的想法是在 S3 上缓存并等待数据,这样我们就可以保持较低的计算时间,并使用 CloudFront 为请求文件的所有用户提供较低的延迟。

我仍在学习这个系统,并想知道是否有人对这个想法有任何反馈或了解它是如何运作的。我也很好奇像 Cassandra 这样的项目的目的。我的理解是,只需将我们的应用程序放在 EC2 服务器上,就可以根据服务器的性质进行扩展。 Cassandra 只是为了保持较低的资源使用率,还是即使在 EC2 上也有理由使用这样的系统?

CloudFront:http://aws.amazon.com/cloudfront/ EC2:http://aws.amazon.com/cloudfront/ 卡桑德拉:http://cassandra.apache.org/

We have created a product that potentially will generate tons of requests for a data file that resides on our server. Currently we have a shared hosting server that runs a PHP script to query the DB and generate the data file for each user request. This is not efficient and has not been a problem so far but we want to move to a more scalable system so we're looking in to EC2. Our main concerns are being able to handle high amounts of traffic when they occur, and to provide low latency to users downloading the data files.

I'm not 100% sure on how this is all going to work yet but this is the idea:

We use an EC2 instance to host our admin panel and to generate the files that are being served to app users. When any admin makes a change that affects these data files (which are downloaded by users), we make a copy over to S3 using CloudFront. The idea here is to get data cached and waiting on S3 so we can keep our compute times low, and to use CloudFront to get low latency for all users requesting the files.

I am still learning the system and wanted to know if anyone had any feedback on this idea or insight in to how it all might work. I'm also curious about the purpose of projects like Cassandra. My understanding is that simply putting our application on EC2 servers makes it scalable by the nature of the servers. Is Cassandra just about keeping resource usage low, or is there a reason to use a system like this even when on EC2?

CloudFront: http://aws.amazon.com/cloudfront/
EC2: http://aws.amazon.com/cloudfront/
Cassandra: http://cassandra.apache.org/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虐人心 2024-09-17 09:15:58

Cassandra 是一个非关系数据库引擎,如果这是您所需要的,您应该首先评估 Amazon 的 SimpleDB :构建在 S3 之上的非关系数据库引擎。

如果文件只需要根据时间(每天、每小时……)进行更新,那么这似乎是一个合理的解决方案。但您可以考虑在 2 个 EC2 映像前面放置一个负载均衡器,每个映像运行您的应用程序的副本。如果一个实例发生故障,这将使以后更容易扩展并且更安全。

您应该阅读的其他一些服务:

http://aws.amazon.com/elasticloadbalancing/ -- 亚马逊的负载均衡器解决方案。

http://aws.amazon.com/sqs/ -- 用于在系统之间传递消息,在您的 DA(分布式架构)中。例如,如果您希望创建数据文件的系统与托管站点的系统不同。

http://aws.amazon.com/autoscaling/ -- 允许您调整基于流量的在线实例

确保 EC2 具有良好的备份过程,经常为操作系统驱动器创建快照,并将任何易失性数据(例如数据库文件)放置在 EBS 块上。 EC2 不会经常发生故障,但一旦发生故障,您将无法访问硬件,如果您有最新的快照,您只需在线启动一个新实例即可。

Cassandra is a non-relational database engine and if this is what you need, you should first evaluate Amazon's SimpleDB : a non-relational database engine built on top of S3.

If the file only needs to be updated based on time (daily, hourly, ...) then this seems like a reasonable solution. But you may consider placing a load balancer in front of 2 EC2 images, each running a copy of your application. This would make it easier to scale later and safer if one instance fails.

Some other services you should read up on:

http://aws.amazon.com/elasticloadbalancing/ -- Amazons load balancer solution.

http://aws.amazon.com/sqs/ -- Used to pass messages between systems, in your DA (distributed architecture). For example if you wanted the systems that create the data file to be different than the ones hosting the site.

http://aws.amazon.com/autoscaling/ -- Allows you to adjust the number of instances online based on traffic

Make sure to have a good backup process with EC2, snapshot your OS drive often and place any volatile data (e.g. a database files) on an EBS block. EC2 doesn't fail often but when it does you don't have access to the hardware, and if you have an up to date snapshot you can just kick a new instance online.

反差帅 2024-09-17 09:15:58

根据数据集,Cassandra 还可以显着缩短查询响应时间。

对 NoSQL 解决方案中使用的数据结构有一个很好的解释,可以帮助您了解这是否是一个合适的解决方案来提供帮助:

WTF 是一个超级列

Depending on the datasets, Cassandra can also significantly improve response times for queries.

There is an excellent explanation of the data structure used in NoSQL solutions that may help you see if this is an appropriate solution to help:

WTF is a Super Column

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文