重负载 LAMP 应用的最佳硬件配置是什么

发布于 2024-08-25 03:20:14 字数 640 浏览 8 评论 0原文

我需要为大量并发用户运行 Linux-Apache-PHP-MySQL 应用程序(Moodle 电子学习平台) - 我的目标是 5000 个用户。我所说的并发是指 5000 人应该能够同时使用该应用程序。 “工作”不仅意味着数据库读取,还意味着数据库写入。

该应用程序不是很典型,因为它在数据库上执行大量插入/更新,因此缓存技术没有多大帮助。我们使用InnoDB存储引擎。此外,编写应用程序时并没有考虑到性能。例如,一个 Apache 线程通常占用大约 30-50 MB 的 RAM。

我非常乐意了解构建能够处理此类负载的可扩展配置所需的硬件信息。

我们现在使用两台 HP DLG 380,带有两个 4 核处理器,能够处理低得多的负载(通常为 300-500 个并发用户)。投资这种盒子并使用它们构建集群是否合理,还是配备一些更高端的硬件更好?

我特别好奇

  • 服务器有多少、有多强大 需要什么(处理器/内核的数量、RAM 的大小)
  • 网络设备应该 使用(什么样的开关, 网卡)
  • 任何其他硬件, 像特定的光盘存储 需要的解决方案等

另一件事是如何将所有内容组合在一起,这就是最优化的架构。使用 MySQL 进行集群相当困难(人们在抱怨 MySQL Cluster,甚至在 Stackoverflow 上也是如此)。

I need to run Linux-Apache-PHP-MySQL application (Moodle e-learning platform) for a large number of concurrent users - I am aiming 5000 users. By concurrent I mean that 5000 people should be able to work with the application at the same time. "Work" means not only do database reads but writes as well.

The application is not very typical, since it is doing a lot of inserts/updates on the database, so caching techniques are not helping to much. We are using InnoDB storage engine. In addition application is not written with performance in mind. For instance one Apache thread usually occupies about 30-50 MB of RAM.

I would be greatful for information what hardware is needed to build scalable configuration that is able to handle this kind of load.

We are using right now two HP DLG 380 with two 4 core processors which are able to handle much lower load (typically 300-500 concurrent users). Is it reasonable to invest in this kind of boxes and build cluster using them or is it better to go with some more high-end hardware?

I am particularly curious

  • how many and how powerful servers are
    needed (number of processors/cores, size of RAM)
  • what network equipment should
    be used (what kind of switches,
    network cards)
  • any other hardware,
    like particular disc storage
    solutions, etc, that are needed

Another thing is how to put together everything, that is what is the most optimal architecture. Clustering with MySQL is rather hard (people are complaining about MySQL Cluster, even here on Stackoverflow).

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

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

发布评论

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

评论(3

时常饿 2024-09-01 03:20:15

一旦超过了几台物理机无法为您提供所需峰值负载的程度,您可能想要开始虚拟化。

EC2 可能是目前 LAMP 堆栈最灵活的解决方案。您可以将虚拟机设置为物理机,对它们进行集群,在需要更多计算时间时启动它们,在非高峰时间关闭它们,创建机器映像以便轻松进行系统测试

...可用于负载平衡和自动启动的各种解决方案。

如果您可以使您的应用程序适合,您也可以使用他们的非关系数据库引擎。在非常高的负载下,关系数据库(尤其是 MySQL)无法有效扩展。随着硬件的添加,SimpleDB、BigTable 和类似的非关系数据库的峰值负载几乎可以线性扩展。

不过,摆脱关系数据库是一个巨大的进步,我不能说我自己曾经需要这样做。

Once you get past the point where a couple of physical machines aren't giving you the peak load you need, you probably want to start virtualising.

EC2 is probably the most flexible solution at the moment for the LAMP stack. You can set up their VMs as if they were physical machines, cluster them, spin them up as you need more compute-time, switch them off during off-peak times, create machine images so it's easy to system test...

There are various solutions available for load-balancing and automated spin-up.

If you can make your app fit, you can get use out of their non-relational database engine as well. At very high loads, relational databases (and MySQL in particular) don't scale effectively. The peak load of SimpleDB, BigTable and similar non-relational databases can scale almost linearly as you add hardware.

Moving away from a relational database is a huge step though, I can't say I've ever needed to do it myself.

ㄟ。诗瑗 2024-09-01 03:20:15

我不太确定硬件,但从软件的角度来看:

有了一个高效的数据层,可以缓存从数据库返回的对象和集合,那么我会说标准的主从配置可以正常工作。将所有写入路由到强大的主服务器,将所有读取路由到从服务器,并根据需要添加更多从服务器。

将数据缓存为从数据映射器/ORM 返回的对象而不是 HTML,并使用 Memcached 作为缓存层。如果您更新一个对象,然后写入数据库并在 memcached 中更新,最好使用 IdentityMap 模式。您可能需要相当多的 Memcached 实例,尽管您可以在 Web 服务器上运行这些实例。

我们永远无法让 MySQL 集群正常工作。

小心你编写的 SQL 查询,应该没问题。

I'm not so sure about hardware, but from a software point-of-view:

With an efficient data layer that will cache objects and collections returned from the database then I'd say a standard master-slave configuration would work fine. Route all writes to a beefy master and all reads to slaves, adding more slaves as required.

Cache data as objects returned from your data-mapper/ORM and not HTML, and use Memcached as your caching layer. If you update an object then write to the db and update in memcached, best use IdentityMap pattern for this. You'll probably need quite a few Memcached instances although you could get away with running these on your web servers.

We could never get MySQL clustering to work properly.

Be careful with the SQL queries you write and you should be fine.

等待我真够勒 2024-09-01 03:20:15

Piotr,您是否尝试过在 moodle.org 上提出这个问题?目前有几个类似的范围设施,其工作人员正在回答这个问题。

另外,根据您的部署时间范围,您可能想要查看 Moodle 2.0 系列而不是 Moodle 1.9 系列,看起来该版本中的 Moodle 架构的一些问题有很多很好的修复。

另外:memcached 对此非常有用。 php 加速对此很有效。不过,serverfault 可能是解决这个问题的更好的*交换站点

Piotr, have you tried asking this question on moodle.org yet? There are a couple of similar scoped installations whose staff members answer that currently.

Also, depending on what your timeframe for deployment is, you might want to check out the moodle 2.0 line rather than the moodle 1.9 line, it looks like there are a bunch of good fixes for some of the issues with moodle's architecture in that version.

also: memcached rocks for this. php acceleration rocks for this. serverfault is probably the better *exchange site for this question though

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