我已经将我们的堆栈转换为 Rails 4(是的!)
我希望利用线程安全代码。
Puma 的工作是起床,停止它似乎是一个不同的问题:(
Puma 是唯一的多螺纹导轨吗?
Thin -> EventMachine
Unicorn -> Forking
Puma -> multi-threaded
Mongrel -> don't care
Webbrick -> don't care
否。按字母顺序排列:
-
Iodine https://github.com/boazsegev/iodineHTTP / Websocket 服务器和 EventMachine 替代方案(基于 kqueue/epoll)
-
Net::HTTP::Server https://github.com/postmodern/net-http-server尽管没有广告,但支持多线程
-
Phusion 乘客 https://www.phusionpassenger.com/已经支持多线程自 v4 测试版以来 http://blog.phusion.nl/2012/08/03/why-rails-4-live-streaming-is-a-big-deal/
-
彩虹! http://rainbows.rubyforge.org/支持多种并发模型,包括多线程
-
Reel https://github.com/celluloid/reel/ is a 赛璐珞 http://celluloid.io/支持“事件”服务器,“也非常适合多线程应用程序,并且也提供传统的多线程阻塞 I/O 支持”
-
Thin http://code.macournoyer.com/thin/有一个线程模式,可以通过传递来启用
--threaded
或通过设置threaded: true
在适当的配置文件中(例如bundle exec thin start --threaded
)
-
WEBrick http://ruby-doc.org/stdlib-2.1.0/libdoc/webrick/rdoc/WEBrick.html它本身是多线程的,因此将其作为一种选择消除是不公平的;如果您使用的是 Rails 嵌入式版本,则需要猴子补丁Rails::Server启用多线程 https://stackoverflow.com/a/20940926/504845
-
Zbatery http://zbatery.bogomip.org/以彩虹为基础!并支持 Rainbows! 的所有并发模型!支持
请注意,目前MRI Ruby 一次仅运行一个线程由于其全局解释器锁(GIL) https://en.wikipedia.org/wiki/Global_Interpreter_Lock。您只能通过使用不同的 Ruby 运行时(例如JRuby http://jruby.org/ or Rubinius http://rubini.us/,它提供对本机线程的访问。如果您决定使用 JRuby,有几种选择值得探索的依赖 JVM 的服务器 https://github.com/jruby/jruby/wiki/Servers.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)