erlang 可以处理多少并发 http 请求
我正在开发一个用于基准测试的应用程序,为此我需要在短时间内创建大量的http连接,我用java创建了一个程序来测试java能够创建多少线程,结果在我的2GB单核中机器上,限制在 5000 到 6000 之间变化,并向 JVM 提供 1 GB 内存,之后它会遇到内存不足错误并达到堆限制。
建议erlang将能够生成更多的并发进程,如果erlang能够解决问题,我愿意学习erlang,erlang是否能够生成大约100000个进程,这些进程本质上是等待响应的http请求,在几秒钟的时间,不会达到任何限制,如内存错误等,
I am developing a application for benchmarking purposes, for which I require to create large number of http connection in a short time, I created a program in java to test how much threads is java able to create, it turns out in my 2GB single core machine, the limit is variable between 5000 and 6000 with 1 GB of memory given to JVM after which it hits outofmemoryerror with heap limit reached.
It is suggested that erlang will be able to generate much more concurrent processes, I am willing to learn erlang if it is capable of solving the problem , can erlang be able to generate somewhere around 100000 processes which are essentially http requests waiting for responses, in a matter of few seconds without reaching any limit like memory error etc.,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据著名的 Richard Jones 博客 您几乎可以开箱即用地处理 100k 连接。您必须增加进程限制,请参阅 +P 参数,它需要一点内存管理技巧,例如 gc 或 hibernate。为了取得更多的成果,你必须使用 C 进行更多的黑客攻击。
According famous Richard Jones blog you can handle 100k connection almost out of the box. You have to increase process limit, see
+P
parameter and it needs little bit memory management trickery e.g. gc or hibernate. To achieve significantly more you have to do more hacking with C.它几乎可以处理你扔给它的任何东西。 Erlang 进程非常轻量。
请参阅http://www.sics.se/~joe/apachevsyaws.html Yaws 和 Apache 之间的并发基准。它让您很好地了解可能性。
It can handle pretty much anything you throw at it. Erlang processes are extremely light weight.
See http://www.sics.se/~joe/apachevsyaws.html for a benchmark in concurrency between Yaws and Apache. It gives you a good idea of what's possible.
我认为一件有趣的事情是,一个人能够通过 mochiweb 获得一百万个彗星连接 http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1
I thought an interesting thing for this is that a guy was able to get a million comet connections with mochiweb http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1
如前所述,很多是一个很好的答案。而且考虑到您的要求是编写一个 tsunami 客户端,您可以/应该将代码分发到多个 erlang 节点。
更好的是,您可能想查看 Tsung。它是一个用 erlang 编写的分布式负载测试应用程序。
如果您不想使用它,我很确定其中有您想要阅读的代码。
As previously stated, a lot is a good answer. And also given your requirement is to write a tsunami client, you can/should distribute code over to several erlang nodes.
Even better, you might want to check out Tsung. It is a distributed load testing application written in erlang.
And if you don't want to use it, I am pretty sure there's code you want to read in there.