播放框架2.0.x AskTimeoutException [英] Play framework 2.0.x AskTimeoutException
问题描述
我正在尝试在Play 2.0.2应用上进行一些负载测试,但是我一直遇到以下异常:
I'm trying to do some load testing on my Play 2.0.2 app, but I keep running into the following exception:
无法调用该操作,最终出现错误:抛出(akka.pattern.AskTimeoutException:超时)
我正在使用 http://blitz.io/进行负载测试.
I'm using http://blitz.io/ to do my load testing.
我的技术栈是Play + mysql.
My tech stack is Play + mysql.
我在应用程序中没有使用任何承诺.
I'm not using any promises in my app.
这是自定义的akka配置:
Here's the customized akka configuration:
#default timeout for promises
promise.akka.actor.typed.timeout=10s
play {
akka {
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
loglevel = ERROR
actor {
deployment {
/actions {
router = round-robin
nr-of-instances = 100
}
/promises {
router = round-robin
nr-of-instances = 100
}
}
retrieveBodyParserTimeout = 10 second
actions-dispatcher = {
fork-join-executor {
parallelism-factor = 100
parallelism-max = 200
}
}
promises-dispatcher = {
fork-join-executor {
parallelism-factor = 100
parallelism-max = 200
}
}
websockets-dispatcher = {
fork-join-executor {
parallelism-factor = 100
parallelism-max = 200
}
}
default-dispatcher = {
fork-join-executor {
parallelism-factor = 100
parallelism-max = 200
}
}
}
}
}
另一件事:应用程序运行一天左右后,它开始变慢.在检查资源(使用htop)后,我发现cpu利用率为100%,因此很明显该节点被卡住了太多的工作,以至于其响应被极大地延迟了.此外,我可以看到平均产生了许多Java实例(8-10).这是为什么? Play应用会自然产生那么多Java实例吗?关于内存使用情况,在生成时,java play实例会获得512MB-1536MB的内存,从统计数据中我可以看到,内存的平均使用量约为50-70%,因此可能不是问题所在(可能是内存泄漏等)
One more thing: After the application runs for a day or so, it starts slowing down. Upon checking the resources (using htop), I see that the cpu utilization is 100%, so its clear that the node is stuck doing too much work that it's response gets delayed immensely. Furthermore, I can see that a lot of java instances have been spawned (8-10) on average. Why is that? Is it natural for a Play app to spawn so many java instances? About mem usage, the java play instance gets 512MB-1536MB at the time of spawning and I can see from the stats that the memory is about 50-70% used on average so probably thats not where the problem is (possible mem leaks etc).
我的工作日程非常紧张,因此,我很乐意为调查(或可能解决)此问题提供任何帮助/指针.
I'm running on an extremely tight schedule, so I would appreciate any help/pointers I can get into investigating (or possibly fixing) this issue.
感谢一堆!
推荐答案
我认为您可能会有一些阻塞的IO,这就是为什么您需要retrieveBodyParserTimeout = 10 second
hack的原因.尝试使其异步.
i think you might have some blocking IO, which is why you need the retrieveBodyParserTimeout = 10 second
hack. Try making it async.
这篇关于播放框架2.0.x AskTimeoutException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!