Mochiweb 的可扩展性功能

发布于 2024-09-03 05:08:58 字数 348 浏览 8 评论 0原文

从迄今为止我读过的所有有关 Mochiweb 的文章中,我一遍又一遍地听到 Mochiweb 提供了非常好的可扩展性。我的问题是,Mochiweb 究竟如何获得其可扩展性属性?是来自 Erlang 固有的可扩展性属性,还是 Mochiweb 是否有任何额外的代码可以显式地使其能够良好地扩展?换句话说,如果我自己用 Erlang 编写一个简单的 HTTP 服务器,用一个简单的“循环”(递归函数)来处理请求,它是否具有与使用 Mochiweb 框架构建的简单 Web 服务器相同级别的可扩展性?

更新:我不打算实现一个支持所有可能功能的完整网络服务器。我的要求非常具体 - 使用固定控件处理来自 HTML 表单的 POST 数据。

From all the articles I've read so far about Mochiweb, I've heard this over and over again that Mochiweb provides very good scalability. My question is, how exactly does Mochiweb get its scalability property? Is it from Erlang's inherent scalability properties or does Mochiweb have any additional code that explicitly enables it to scale well? Put another way, if I were to write a simple HTTP server in Erlang myself, with a simple 'loop' (recursive function) to handle requests, would it have the same level of scalability as a simple web server built using the Mochiweb framework?

UPDATE: I'm not planning to implement a full blown web-server supporting every feature possible. My requirements are very specific - to handle POST data from a HTML form with fixed controls.

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

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

发布评论

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

评论(2

各自安好 2024-09-10 05:08:58

大概。 :-)

如果您要编写一个 Web 服务器来在单独的进程(Erlang 中的轻量级线程)中处理每个请求,您可以轻松地达到相同的“可扩展性”。当然,功能集会有所不同,除非您实现 Mochiweb 拥有的所有功能。

Erlang 还内置了对多台机器之间分发的强大支持,这可能会用于获得更大的可扩展性。

Probably. :-)

If you were to write a web server that handles each request in a separate process (light weight thread in Erlang) you could reach the same kind of "scalability" easily. Of course the feature set would be different, unless you implement everything Mochiweb has.

Erlang also has great built in support for distribution among many machines, this might be possible to use to gain even more scalability.

如果没有你 2024-09-10 05:08:58

据我了解,MochiWeb 本身不可扩展。它是一个快速、小型的服务器库,每秒可以处理数千个请求。它执行此操作的方式与“可扩展性”无关(除了调整在任何给定时间正在侦听的 mochiweb_acceptor 的数量)。

使用 MochiWeb,您将得到一个可靠的 Web 服务器库,以及 Erlang 的可扩展性功能。如果您想运行单个 MochiWeb 服务器,当收到请求时,您仍然可以将处理该请求的工作卸载到您想要的任何计算机上,这要归功于 Erlang 的分布式节点基础设施和廉价的消息传递。如果您想运行多个 MochiWeb 服务器,您可以将它们放在负载均衡器后面,并使用 mnesia 的分布式功能在计算机之间同步会话数据。

关键是,MochiWeb 又小又快(足够)。 Erlang 是可扩展性强大的工具。


如果您推出自己的服务器解决方案,您可能会达到或超越 MochiWeb 的效率和开箱即用的“可扩展性”。但随后你就必须重新思考他们已经想到的一切,并且你必须亲自进行战斗测试。

MochiWeb isn't scalable itself, as far as I understand it. It's a fast, tiny server library that can handle thousands of requests per second. The way in which it does that has nothing to do with "scalability" (aside from adjusting the number of mochiweb_acceptors that are listening at any given time).

What you get with MochiWeb is a solid web server library, and Erlang's scalability features. If you want to run a single MochiWeb server, when a request comes in, you can still offload the work of processing that request to any machine you want, thanks to Erlang's distributed node infrastructure and cheap message passing. If you want to run multiple MochiWeb servers, you can put them behind a load balancer and use mnesia's distributed features to sync session data between machines.

The point is, MochiWeb is small and fast (enough). Erlang is the scalability power tool.


If you roll your own server solution, you could probably meet or beat MochiWeb's efficiency and "scalability" out of the box. But then you'd have to rethink everything they've already thought of, and you'd have to battle test it yourself.

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