puma是唯一的多线程rails 4 http服务器吗? [英] Is puma the ONLY multi-threaded rails 4 http server?

查看:63
本文介绍了puma是唯一的多线程rails 4 http服务器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将堆栈转换为Rails 4(是!)

并且我希望利用线程安全代码.

彪马起床,阻止它似乎是另一个问题:(

Puma是唯一的多线程导轨吗?

Thin -> EventMachine
Unicorn -> Forking
Puma -> multi-threaded

Mongrel -> don't care
Webbrick -> don't care

解决方案

否.按字母顺序:

  • Iodine HTTP/Websocket服务器& EventMachine替代项(基于kqueue/epoll)
  • 尽管没有广告,但
  • Net::HTTP::Server ,支持多线程
  • Phusion Passenger 支持多线程彩虹! 支持多种并发模型,包括多线程
  • 具有线程模式,可以通过传递来启用--threaded或通过在适当的配置文件(例如bundle exec thin start --threaded)中设置threaded: true
  • WEBrick 本身是多线程的,因此将其作为选项消除是不公平的.如果您使用的是Rails嵌入式版本,则需要 monkey-patch Rails::Server启用多线程
  • Zbatery 是基于Rainbows!并支持Rainbows的所有并发模型!支持

请注意,由于 JRuby 依赖JVM的服务器值得探索. /p>

I've gotten our stack converted to Rails 4 (yea!)

and I'm looking to take advantage of the thread-safe code.

Puma works in getting up, stopping it appears to be a different problem :(

Is Puma the only multi-threaded rails?

Thin -> EventMachine
Unicorn -> Forking
Puma -> multi-threaded

Mongrel -> don't care
Webbrick -> don't care

解决方案

No. In alphabetical order:

  • Iodine a HTTP / Websocket Server & EventMachine alternative (kqueue/epoll based)
  • Net::HTTP::Server, despite the lack of advertising, supports multithreading
  • Phusion Passenger has supported multithreading since v4 beta
  • Rainbows! supports multiple concurrency models, including multithreading
  • Reel is a Celluloid-backed "evented" server, which "also works great for multithreaded applications and provides traditional multithreaded blocking I/O support too"
  • Thin has a threaded mode, which can be enabled by passing --threaded or by setting threaded: true in the appropriate configuration file (e.g. bundle exec thin start --threaded)
  • WEBrick is on its own multithreaded, so it's not fair to eliminate it as an option; if you're using the Rails-embedded version, you'll need to monkey-patch Rails::Server to enable multi-threading
  • Zbatery is based on Rainbows! and supports all concurrency models that Rainbows! supports

Note that currently MRI Ruby runs only one thread runs at a time due to its global interpreter lock (GIL). You'll only be truly able to exploit multithreading by using a different Ruby runtime such as JRuby or Rubinius, which provide access to native threads. If you decide to go with JRuby, there are several JVM-dependent servers worth exploring.

这篇关于puma是唯一的多线程rails 4 http服务器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆