Apache 和 c10k

发布于 2024-07-15 10:21:49 字数 219 浏览 10 评论 0原文

在正常情况下,Apache 如何处理c10k 问题? 比如说,在运行数据很少的非常小的脚本时,或者如果我使用 Apache,我是否需要横向扩展?

在后台,繁重的工作是由一些运行专门软件来处理请求的服务器完成的,但我想使用 Apache 作为前端。 这是一个可行的计划吗?

How is Apache in respect to handling the c10k problem under normal conditions ?
Say while running very small scripts with little data, or do I need to scale out if I use Apache?

In the background heavy lifting is done by a few servers running specialized software that processes the requests but I'd like to use Apache as a front. Is this a viable plan?

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

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

发布评论

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

评论(3

一张白纸 2024-07-22 10:21:49

我认为 Apache 更像是一个原始服务器 - 运行 mod_php 或 mod_perl 之类的东西来生成内容并智能地路由到适当的系统。

如果您的网站前端获得了数千个并发点击,并且返回了混合类型的数据(静态和动态),您可能会发现在其前端放置一个更优化的系统很有用。

Apache 的经典后优化问题不是生成动态内容(或者至少可以在过程的早期进行优化),而只是等待慢速客户端能够接收正在发送的字节。 因此,在服务器前面放置 Squid 或 Nginx 形式的反向代理来接管慢速网络客户端的“填鸭式”服务,同时允许内容生产完全进行,这是一个显着的优势。速度,并且以本地网络速度 - 100Mb/秒甚至千兆位速度 - 如果它甚至必须穿越网络。

I consider Apache to be more of an origin server - running something like mod_php or mod_perl to generate the content and being smart about routing to the appropriate system.

If you are getting thousands of concurrent hits to the front of your site, with a mix of types of data (static and dynamic) being returned, you may find it useful to put a more optimised system in front of it though.

The classic post-optimisation problem with Apache isn't generating the dynamic content (or at least, that can be optimised for early in the process), but simply waiting for a slow client to be able to receive the bytes that are being sent. It can therefore be a significant advantage to put a reverse proxy, in the form of Squid or Nginx, in front of the servers to take over the 'spoon-feeding' of the slow network clients, while allowing the content production to happen at full speed, and at local network speeds - 100Mb/sec or even gigabit speeds - if it even has to traverse a network at all.

四叶草在未来唯美盛开 2024-07-22 10:21:49

我假设您可能已经看过此数据,但如果没有,它可能会给你一些想法。

I'm assuming you've probably seen this data, but if not, it might give you some idea.

昇り龍 2024-07-22 10:21:49

伙计们,想象一下您正在运行具有 10K 连接(同时)的 Web 服务器。 怎么会这样?

  • 每秒有很多连接

    • 动态内容

      <块引用>

      例如,您确定您的 CPU 可以处理那么多 PHP 会话吗? 我想不会,那么你为什么要考虑 C10K 问题呢? :D

    • 静态内容 - 小文件

      <块引用>

      还有那么多连接? 在单个服务器上? 也许您也遇到了网络/吞吐量问题,或者您是 Google 未来的竞争对手。 使用解决C10K问题并且稳定的lighttpd——fly light。 将 Apache 仅用于大型站点的静态文件是显而易见的。

  • 您的客户长时间下载大文件 - 静态内容

    • ISO 映像、档案等

      <块引用>

      如果您通过网络服务器执行此操作 - FTP 可能更合适。

    • 视频流

      <块引用>

      使用lighttpd或专门的软件。 还有...其他资源怎么样?

我正在使用 Linux 虚拟服务器作为 apache 服务器前面的负载平衡器(带有 LVS-NAT 的特定补丁),我很高兴:) 这个字符串是您想听到的答案。

Guys, imagine that you are running web server with 10K connections (simultaneous). How could it be?

  • You've got many many connections per second

    • Dynamic content

      Are you sure that your CPU can handle that many PHP sessions for example? I guess no, so why are you thinking about C10K problem? :D

    • Static content - small files

      And still soo many connections? On single server? Probably you've got problems with networking/throughput too or you are future competitor of Google. Use lighttpd which addresses C10K problem and is stable - fly light. Using Apache for only static files for large sites is obvious.

  • Your clients are downloading large files for a large time - static content

    • ISO images, archives etc

      If you are doing it via web server - FTP may be more appropriate.

    • Video streaming

      Use lighttpd or specialized software. And still... What about other resources?

I am using Linux Virtual Server as load balancer in front of apache servers (with specific patches for LVS-NAT) and I am happy :) This string is an answer you want to hear.

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