简体   繁体   English

如何在JRuby中使Rails应用异步?

[英]How to make Rails app asynchronous in JRuby?

I've read some tutorials that how to make Rails app asynchronous to improve the application throughput: 我已经阅读了一些教程,这些教程如何使Rails应用程序异步化以提高应用程序吞吐量:

http://thingsaaronmade.com/blog/improving-application-throughput-900-percent-with-asynchronous-responses-in-rails-3.html http://thingsaaronmade.com/blog/improving-application-throughput-900-percent-with-asynchronous-responses-in-rails-3.html

https://github.com/igrigorik/async-rails https://github.com/igrigorik/async-rails

None of them works in JRuby. 它们都不在JRuby中工作。 I know that Rails/JRuby handles concurrency better than MRI, but I don't know how to do it. 我知道Rails / JRuby的并发性比MRI更好,但是我不知道该怎么做。

What is the right approach for this in JRuby? 在JRuby中什么是正确的方法?

Since JRuby is running on JVM, it can scale pretty well, just out of the box. 由于JRuby在JVM上运行,因此可以很好地扩展,即开即用。 So a simple and quite cheap solution would be to throw some more resources at it. 因此,一种简单且相当便宜的解决方案是在其上投入更多资源。 Nowadays hosting providers have many different hosting plans, so it might be a case of a few extra bucks a month. 如今,托管服务提供商有许多不同的托管计划,因此每月可能需要多花几美元。

Also you could leverage a power of async web servers like Goliath or Puma and for example create web services for the parts of your RoR application which require to serve many connections per second. 同样,您可以利用GoliathPuma等异步Web服务器的强大功能,例如为RoR应用程序的各个部分创建Web服务,这些服务需要每秒提供许多连接。

Finally, there is pretty good article touching async web servers and performance topics. 最后,还有一篇很好的文章涉及异步Web服务器和性能主题。 You can find it here: Web technologies for speed up 您可以在这里找到它: 加速网络技术

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM