赫罗库 |应用程序不同部分的不同性能参数
我有一个在 Heroku 上托管的 Rails 3 应用程序,它具有非常常见的配置,其中我的应用程序有一个面向客户端的部分:www.myapplication.com 和我的应用程序 admin.myapplication.com 的管理部分。
我希望我的应用程序中面向客户的部分能够快速运行,并且我并不真正关心我的管理模块有多快。我真正关心的是我不希望在我的管理站点上使用来减慢我的应用程序面向客户端的部分。
理想情况下,我的应用程序客户端有 3 个专用测功机,而我的管理端将有 1 个专用测功机。
有谁知道实现此目标的最佳方法吗?
谢谢!
I have an Rails 3 application hosted on heroku, it has pretty common configuration where I have a client facing part of my application say: www.myapplication.com and an admin part of my application admin.myapplication.com.
I want my client facing part of my application to be fast, and I don't really care about how fast my admin module is. What I do care about is that I do not want usage on my admin site to slow down the client facing part of my application.
Ideally my client-side of the app with have 3 dedicated dynos, and my admin side will have 1 dedicated dyno.
Does anyone have any idea on the best way to accomplish this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果拆分应用程序,您将在两个应用程序之间共享数据库连接。老实说,我只需要一个应用程序并给它 4 个 dynos :)
另外,Dynos 不会提高性能,它们会增加吞吐量,因此您能够每秒处理更多请求。
例如,
粗略地 - 如果典型的页面响应为 100 毫秒,则 1 个 dyno 每秒可以处理 10 个请求。如果您只有一个测功机,并且您的应用程序突然每秒收到 10 个请求,那么多余的请求将排队,直到测功机空闲来处理这些请求。还要求> 30s就会超时。
如果您添加第二个 dyno,请求将在 2 个 dyno 之间共享,因此您现在能够每秒处理 20 个请求(在理想情况下),依此类推,当您添加更多 dyno 时。
请记住,dyno 是单线程的,因此,如果它正在执行任何操作,即渲染页面、构建 pdf 并包括接收上传的图像等,那么它会很忙,并且在完成之前无法处理进一步的请求,并且如果您没有更多的 dynos 请求将排队。
If you split the applications you're going to have share the database connections between the two apps. To be honest, I'd just have it one single app and give it 4 dynos :)
Also, Dynos don't increase performance, they increase throughput so you're capable of dealing with more requests a second.
For example,
Roughly - If a typical page response is 100ms, 1 dyno could process 10 requests a second. If you only have a single dyno and your app suddenly receives 10 requests per second then the excess requests will be queued until the dyno is free'd up to process those requests. Also requests > 30s will be timed out.
If you add a second dyno requests would be shared between the 2 dynos so you'd now be able to process 20 requests a second (in an ideal world) and so on as you add more dynos.
And remember a dyno is single threaded, so if it's doing something ANYTHING ie rendering a page, building a pdf and including receiving an uploaded image etc then it's busy and unable to process further requests until it's finished and if you don't have an more dynos requests will be queued.
我的建议是将您的应用程序分成逻辑部分。为管理界面提供单独的应用程序是一件好事。
它不必与主应用程序位于同一域中。它可以具有全局客户端 IP 限制或只是简单的全局基本身份验证。
为什么要把事情复杂化并将两件事塞进一个应用程序中?这还允许您对管理部分进行更多实验并重新部署它,而不会影响您的用户。
My advice is to split your application into it's logical parts. Having a separate application for the admin interface is a good thing.
It does not have to be on the same domain as the main application. It could have a global client IP restriction or just a simple global Basic Auth.
Why complicate things and stuff two things into one application? This also lets you eperimenting more with the admin part and redeploy it without affecting your users.