简体   繁体   English

在短时间内交通量大

[英]High traffic volume in short amount of time

I'm looking for some advice here. 我在这里寻找一些建议。 My school's student section registration process is online and involves around 6,000 students 我学校的学生部分注册流程在线,涉及约6000名学生

They base seating off first come first serve basis. 他们以先到先得为基础。 Every year they open the site at noon and floods of people get on a try to register as fast as possible to get good seats. 每年他们都会在中午开放这个网站,洪水的人们会尽快注册,以获得良好的座位。 Every year without fail the server crashes and everyone is mad. 每年都没有失败,服务器崩溃,每个人都疯了。

After several years of being frustrated myself, I've offered to redo their registration system. 经过几年的挫折自己,我已经提出重做他们的注册系统。

My plan is to rewrite it in ruby on rails, and use heroku for hosting. 我的计划是在rails上用ruby重写它,并使用heroku进行托管。

  • Does a heroku dyno only handle one request at a time? heroku dyno一次只能处理一个请求吗?
  • Heroku scales up to 50 dynos. Heroku可以扩展到50个dynos。 Will that be enough to handle around 6,000 users with about 5 pageviews per transaction in a short amount of time, say a half hour? 这足以处理大约6,000名用户,在短时间内每次交易可获得约5次综合浏览量,比如半小时?
  • Any helpful strategies or tips you can give me before I dive into this project? 在深入了解这个项目之前,您可以给我任何有用的策略或提示吗?

Does a heroku dyno only handle one request at a time? heroku dyno一次只能处理一个请求吗?

Yes. 是。 Heroku dynos are single threaded. Heroku dynos是单线程的。

Heroku scales up to 50 dynos. Heroku可以扩展到50个dynos。 Will that be enough to handle around 6,000 users with about 5 pageviews per transaction in a short amount of time, say a half hour? 这足以处理大约6,000名用户,在短时间内每次交易可获得约5次综合浏览量,比如半小时?

This depends on how fast your page loads. 这取决于您的网页加载速度。 For arguments sake let's pretend it takes 2s per page request (as per Google Analytics recommendation) and you need to load 6,000 users x 5 page views / 30 minutes - 1000 page views per minute. 为了论证,我们假设每页请求需要2次(根据Google Analytics推荐),您需要加载6,000 users x 5 page views / 30 minutes - 每分钟1000次页面浏览量。

At 2s per page load, one single dyno would load 30 page views per minute. 每页加载2秒,一个dyno每分钟加载30页浏览量。 At 50 dynos, this would be 1500 page views per minute. 在50 dynos,这将是每分钟1500页面浏览量。 This would obviously allow you to exceed your overall goal and leave you some room for error, but if all 6000 users are hitting the page at once then a single Heroku app may not be able to keep up depending on your timeout. 这显然会让你超出你的总体目标并给你一些错误的余地,但是如果所有6000个用户都在同时点击页面,那么单个Heroku应用程序可能无法跟上你的超时。 You would need to implement a user queue system - explained below. 您需要实现用户队列系统 - 如下所述。

Any helpful strategies or tips you can give me before I dive into this project? 在深入了解这个项目之前,您可以给我任何有用的策略或提示吗?

All that said, a 2s load time may vary depending on the assets your page needs to load, the amount it needs to interact with a database, it's queries, caching, etc. Your page can also potentially serve much faster. 总而言之,2s加载时间可能会有所不同,具体取决于您的页面需要加载的资产,与数据库交互所需的数量,查询,缓存等。您的页面也可能更快地提供服务。

You also need to worry about the initial hit of all the users. 您还需要担心所有用户的初始命中。 This could be taken care of via a first come first serve queue system - similar to that used by Ticketmaster if you've ever used their site. 这可以通过先来先服务队列系统来处理 - 类似于Ticketmaster使用过的队列系统。 This could be accomplished via AWS SQS or your preference of queue system. 这可以通过AWS SQS或您对队列系统的偏好来完成。

With a user queue and caching of your assets and common database queries, you should be able to accomplish this with 50 or less dynos. 通过用户队列以及资产和常见数据库查询的缓存,您应该能够使用50或更少的dynos来完成此操作。

EDIT: I'm taking your word for it that Heroku will run 50 web dynos. 编辑:我正在接受他的说法Heroku将运行50个网络dynos。 They show 24 as max on their pricing page, but I cannot find any info one way or another. 他们在定价页面上显示最多24个,但我找不到任何方式的信息。

Does a heroku dyno only handle one request at a time? heroku dyno一次只能处理一个请求吗?

It depends on web server you use ( https://devcenter.heroku.com/articles/dynos#dynos-and-requests ). 这取决于您使用的Web服务器( https://devcenter.heroku.com/articles/dynos#dynos-and-requests )。 If you want more concurrency within a dyno, I'd suggest taking a look at something like Puma . 如果你想在dyno中更多并发,我建议看看像Puma这样的东西。

Heroku scales up to 50 dynos. Heroku可以扩展到50个dynos。 Will that be enough to handle around 6,000 users with about 5 pageviews per transaction in a short amount of time, say a half hour? 这足以处理大约6,000名用户,在短时间内每次交易可获得约5次综合浏览量,比如半小时? Any helpful strategies or tips you can give me before I dive into this project? 在深入了解这个项目之前,您可以给我任何有用的策略或提示吗?

You can have more than 50 dynos. 你可以拥有超过50个dynos。 A specific answer for you app is going to be way better that a guess or generalization. 对于你的应用程序的具体答案将比猜测或概括更好。 Run a load test against your site (eg, using Blitz ) and find out the real numbers. 对您的站点运行负载测试(例如,使用Blitz )并找出实际数字。 Costs for add-ons are pro-rated per second, so you only pay for the period you have it installed. 附加组件的成本按每秒按比例计算,因此您只需支付安装时间。 So make sure you uninstall or downgrade Blitz once you've finished your test. 因此,请确保在完成测试后卸载或降级Blitz。

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

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