I'm running into some problems in production - after a while the webserver just stops responding to certain requests and I get weird timeouts ("play - Cannot invoke the action, eventually got an error: Thrown(akka.pattern.AskTimeoutException: Timed out)").I've made some changes since then - it superficially looked like having a Async { Akka.future { // code that throws an exception } } might be causing it, so I fixed some such issues, but that would seem very weird (and testing it in dev mode in isolation works just fine) and the server effectively hung shortly after redeploying with those fixes as well though without the "play - Cannot invoke the action..." log entries - there's nothing in the log and it's very unclear what actually goes wrong.Since the problems only appear in production, and I don't really want to run a broken site, this makes debugging a bit tricky.The website relies heavily on external APIs that are called with simple http web requests (this is done in a scala library that was written prior to play2, so it's not using the WS stuff). These web requests have all sorts of issues with them - delayed responses, badly formatted returns leading to SAX XML exceptions, etc. Such is life on the internet and those APIs not under my control so I can't fix those issues at the source.All such calls are wrapped in Async { Akka.future { blocks to handle their asynchronous nature, and AFAIK only such calls hang.Reading https://github.com/playframework/Play20/wiki/AkkaCore and http://doc.akka.io/docs/akka/2.0.1/scala/dispatchers.html it seems like the default promises-dispatcher parallelism-factor is 1, which on my 2-core production machines sounds like it would lead to only 2 actor threads handling these calls. That sounds like it's much too low - the calls take 0% CPU, but block for several seconds, and with only 2 processing pipelines they would quickly get backlogged.
Q: Is my reading of those docs correct? If so, why is the parallelism-factor set so low?
Q: How can I see the actual number of actors/threads allocated to the promises-dispatcher? (or any other dispatcher)
Q: Play1 had a very useful "status" command that gave insight into any such backlogging - how can I get similar insight into what's going on in a play2 application?
Reading http://doc.akka.io/docs/akka/2.0.1/scala/logging.html it seems like one can enable per-actor-and-message logging, but how do I do that for play's internal actors?I tried play.akka.loglevel="DEBUG" but then the server hangs on startup and play.akka.loglevel="INFO" didn't give anything useful.
Thanks!
Play version: 2.0.1Replicate: seemingly somewhat reliably. I've upped the parallelism-factor and that seems to have alleviated the problem. There are too many moving parts and the load is varying too much to be super-conclusive, but the hung-request problem appears to have gone away (the database is at 50% continuous CPU load, spiking to 80-90% at times, which then causes some queries to start taking several seconds, which then contributes to the requests getting hung - but they should still recover, and right now they seem to).It seems like the play1 version is causing less CPU load on both the web box and the DB. Some minor changes in cache policies (it's behind nginx which is caching some parts) muddles things a bit though. This is where the "play status" command would have been very useful.
The play2 request object is very limited - in play1 you had access to the controller & method, which helps tremenduously when trying to add some in-process monitoring. Reading the source of https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/core/router/Router.scala and the in-project generated \target\scala-2.9.1\src_managed\main\routes_routing.scala there doesn't seem to be a way to get the HandlerDef out of the router (which AFAICT is the only thing that knows the controller + action combo) - it only gives out Option[Handler] (which is actually an Option[Action] in my case).This makes it harder to do generic instrumentation - or am I missing something?play1 had great thread-state reporting with the "play status" command - there's nothing similar for Akka actors & dispatchers!? (couldn't find anything on google)
On Tuesday, May 22, 2012 7:11:09 AM UTC-7, peter hausel wrote:
On Monday, May 21, 2012 6:18:34 PM UTC-4, Jxtps wrote:I'm running into some problems in production - after a while the webserver just stops responding to certain requests and I get weird timeouts ("play - Cannot invoke the action, eventually got an error: Thrown(akka.pattern.AskTimeoutException: Timed out)").I've made some changes since then - it superficially looked like having a Async { Akka.future { // code that throws an exception } } might be causing it, so I fixed some such issues, but that would seem very weird (and testing it in dev mode in isolation works just fine) and the server effectively hung shortly after redeploying with those fixes as well though without the "play - Cannot invoke the action..." log entries - there's nothing in the log and it's very unclear what actually goes wrong.Since the problems only appear in production, and I don't really want to run a broken site, this makes debugging a bit tricky.The website relies heavily on external APIs that are called with simple http web requests (this is done in a scala library that was written prior to play2, so it's not using the WS stuff). These web requests have all sorts of issues with them - delayed responses, badly formatted returns leading to SAX XML exceptions, etc. Such is life on the internet and those APIs not under my control so I can't fix those issues at the source.All such calls are wrapped in Async { Akka.future { blocks to handle their asynchronous nature, and AFAIK only such calls hang.Reading https://github.com/playframework/Play20/wiki/AkkaCore and http://doc.akka.io/docs/akka/2.0.1/scala/dispatchers.html it seems like the default promises-dispatcher parallelism-factor is 1, which on my 2-core production machines sounds like it would lead to only 2 actor threads handling these calls. That sounds like it's much too low - the calls take 0% CPU, but block for several seconds, and with only 2 processing pipelines they would quickly get backlogged.Which play version are you on? What's the use case? Can you reliably replicate the issue?Q: Is my reading of those docs correct? If so, why is the parallelism-factor set so low?I can not remember the reason off top of my head but you should be able to override every parameter (please see the akka doc http://doc.akka.io/docs/akka/2.0.1/general/configuration.html for more information). Also, on master, promise dispatching has been changed (promises are executed on a separated actor system now - this actor system also fully can be configured)Q: How can I see the actual number of actors/threads allocated to the promises-dispatcher? (or any other dispatcher)https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/resources/reference.conf tells you what we set as defaults which defaults you can override from your app (please note: this reference file is for 2.1 SNAPSHOT). Please see the akka documentation for more details.Q: Play1 had a very useful "status" command that gave insight into any such backlogging - how can I get similar insight into what's going on in a play2 application?I would suggest to change the log levelReading http://doc.akka.io/docs/akka/2.0.1/scala/logging.html it seems like one can enable per-actor-and-message logging, but how do I do that for play's internal actors?I tried play.akka.loglevel="DEBUG" but then the server hangs on startup and play.akka.loglevel="INFO" didn't give anything useful.I could not replicate this using a semi-complex play scala app but will try it with various sample apps.Thanks,PeterThanks!
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/vUGEBYEvR6wJ.--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.