Rails 每秒请求 100 个或更少(对于非缓存页面)是否符合预期?

发布于 2024-12-15 15:30:14 字数 662 浏览 0 评论 0原文

前言:请不要开始讨论过早优化或任何相关内容。我只是想了解我可以从带有 Rails 的单个服务器获得什么样的性能。

我一直在 Rails 3 上对 ruby​​ 进行基准测试,似乎每秒我可以获得的最高请求率约为 100 个请求每秒。

我将 phusion Passenger 与 nginx 和 Ruby 1.8.7 一起使用。

这是在 ec2 m1.large 实例上:

7.5 GB memory
4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each)
850 GB instance storage
64-bit platform
I/O Performance: High
API name: m1.large

该页面是一个非常简单的操作,将一行写入 mysql。

user = User.new
user.name = "test"
user.save

我假设没有缓存(内存缓存等),我只是想感受一下原始数字。

我在同一个 ec2 实例上使用了 apache bench,并且使用了不同级别的请求(从 1000 到 10000 以及不同数量的并发请求 1/5/10/25/50/100)。

Preface: Please don't start a discussion on premature optimization, or anything related. I'm just trying to understand what kind of performance I can get from a single server with rails.

I have been benchmarking ruby on rails 3 and it seems the highest rate of requests per second I can get is around 100 requests per second.

I used phusion passenger with nginx, and Ruby 1.8.7.

This is on a ec2 m1.large instance:

7.5 GB memory
4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each)
850 GB instance storage
64-bit platform
I/O Performance: High
API name: m1.large

The page was a very simple action that wrote a single row into mysql.

user = User.new
user.name = "test"
user.save

I am assuming no caching (memcache, etc), I just want to get a feel for the raw numbers.

I used apache bench on the same ec2 instance, and I used varying levels of # of requests (from 1000 to 10000 and varying numbers of concurrent requests 1/5/10/25/50/100).

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

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

发布评论

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

评论(1

灼疼热情 2024-12-22 15:30:14

EC2 m1.large 实例确实没有那么快,因此这些数字并不令人意外。如果您想要性能,您可以选择更大的实例,因为现在有些实例具有 80 个 ECU,或者尝试不同的提供商。

我发现 Linode 通常以相同的价格提供更高的性能,但不够灵活且无法扩展还有大量的服务器。如果您处于“20 台以下服务器”的部署阶段,那么它更适合您。

也不要认为MySQL是无成本的操作。

The EC2 m1.large instance is really not that fast, so these numbers aren't surprising. If you want performance, you can either spring for a larger instance, as there are now some with 80 ECUs, or try a different provider.

I've found that Linode generally offers higher performance for the same price, but is not as flexible and doesn't scale to very large numbers of servers as well. It's a much better fit if you're in the "under 20 servers" phase of rolling out.

Also don't think that MySQL is a no-cost operation.

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