我正在使用Jruby 1.7.12和Celluloid(0.16.0)。我的应用程序正在使用池并在循环中生成actor
require 'kaiwa'
Kaiwa::Launcher.run
Celluloid.logger = Kaiwa::Logger.logger
class KaiwaTest
include Celluloid
Celluloid::LINKING_TIMEOUT = 5
def initialize
end
def create_kaiwa_users(handle)
Kaiwa::Manager.create_user(handle)
end
def send_kaiwa_messages(to_handle, from_handle, message)
Kaiwa::Manager.send_message(to_handle, from_handle, message)
end
end
kt = KaiwaTest.pool(size: 4)
(0..1_00_000).to_a.each do |index|
kaiwa_test_pool.async.create_kaiwa_users("user_#{index}")
end
在我的库中,每个用户都是一个与经理相关联的演员,经理也是演员。我已经尝试完全取消链接,问题仍然存在。我创建超过30个用户演员的那一分钟我的系统挂起。
在提到JRuby问题时,似乎有一些类似的超时错误,但没有特别涉及链接超时问题。我无法弄清楚导致问题的原因。
提前致谢。
整个代码库位于https://github.com/supersid/kaiwa
感谢我能得到的任何帮助。
答案 0 :(得分:0)
有趣的项目(XMPP +赛璐珞+ jRuby)
我假设kaiwa_test_pool
应该是kt
?
我会尝试使用0.17.0
:
此处您不需要Pool
。您只需要一个专门的Supervision::Container
您需要做的是使用Kaiwa::Manager.supervise as: :manager
然后为您的用户actor实例化监督容器。
不确定为什么要创建0..1_00_000
个用户?
无论哪种方式,都不需要Pool
,使用0.17.0
并使用普通的监督容器。