客运服务器升级:处理器 (CPU) 内核 VS RAM?

发布于 2024-11-12 05:47:51 字数 386 浏览 4 评论 0原文

我浏览了 Passenger 的文档,以了解它可以在硬件配置方面运行多少个应用程序实例。文档仅讨论 RAM

最佳值取决于系统的硬件和服务器的平均负载。您应该尝试不同的值。但一般来说,该值应至少等于您拥有的 CPU(或 CPU 核心)数量。如果您的系统有 2 GB RAM,那么我们建议值为 30。如果您的系统是虚拟专用服务器 (VPS),并且有大约 256 MB RAM,并且还运行 MySQL 等其他服务,那么我们建议值为共 2 个。

它表示最小值可以是我们拥有的 CPU/CPU 核心数。我有一个带有一个 VCPU 和一个 VPS 的 VPS。 1GB 内存和我的服务提供商可以选择仅升级 RAM。我想知道我可以只升级 RAM 到什么程度?升级CPU数量有多重要?

I went through documentation of Passenger to find out how many application instances it can run with respect to hardware configuration. Documentation only talks about RAM

The optimal value depends on your system’s hardware and the server’s average load. You should experiment with different values. But generally speaking, the value should be at least equal to the number of CPUs (or CPU cores) that you have. If your system has 2 GB of RAM, then we recommend a value of 30. If your system is a Virtual Private Server (VPS) and has about 256 MB RAM, and is also running other services such as MySQL, then we recommend a value of 2.

It says minimum value can be number of CPU/CPU Cores we have. I have a VPS with one VCPU & 1GB RAM & my service provider has an option to just upgrade the RAM. I'm wondering how far I can just keep upgrading only RAM? How important it is to upgrade number of CPUs?

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

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

发布评论

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

评论(1

抠脚大汉 2024-11-19 05:47:51

快速回答

取决于哪些资源是您的应用程序的瓶颈。

长答案

您需要考虑一些因素:

  1. 您的应用程序需要多少 CPU 时间?
  2. 您的应用程序的任何给定实例在峰值负载时使用了多少 RAM?
  3. 您的应用程序是否花费大量时间执行 IO 密集型任务? (即:数据库和文件读/写、网络通信)

可能还有其他因素需要考虑,但您的瓶颈可能是上述之一。如果 RAM 是您的主要瓶颈,请务必使用新可用的 RAM。但是,如果事实证明您的应用程序因 CPU 可用性或 IO 泛滥而变慢,那么再多的 RAM 也无法加快速度。

关于CPU核心的话题;我的理解是,运行 Passenger 的主 Apache 进程是一个单线程进程。 Apache 生成新线程来根据需要处理并发。理论上,每个额外的 CPU 核心都允许您生成 x*n 个线程,其中 x 是您可以在单个 CPU 核心下最佳运行的线程数,而 n< /code> 是 Apache 可用的 CPU 核心数。

免责声明:我对 Passenger 内部结构了解不多;尽管这种逻辑通常适用于其他类型的 Apache 配置。

Quick Answer

Depends on what resources are the bottleneck for your app.

Long answer

You'll need to factor in a few things:

  1. How much CPU time does your app need?
  2. How much RAM does any given instance of your app use at peak load?
  3. Does your app spend a lot of time doing IO intensive tasks? (ie: db and file reads/writes, network communication)

There can be other things to factor in, but your bottlenecks will probably be one of the above. If RAM is your main bottleneck, by all means use your newly available RAM. However, if it turns out that your app is being slowed down by CPU availability or flooded IO, no amount of RAM is going to speed things up.

On the topic of CPU cores; my understanding is that the main Apache process that runs Passenger is a single threaded process. Apache spawns new threads to handle concurrency on an as-needed basis. Each additional CPU core theoretically allows you to spawn x*n threads, where x is the number of threads you can optimally run under a single CPU core and n is the number of CPU cores available to Apache.

Disclaimer: I'm not very well read on Passenger internals; though this logic usually holds true for other kinds of Apache configurations.

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