|[2.1.4] Play mixing responses under high load||František Hartman||10/1/13 12:08 PM|
I wrote some JMeter tests for my web app and found out that when cpu usage rises to 100 % and the response time rises to few seconds Play starts mixing the responses - for one request serves response of other request (but not the other way around). The mixed requests are always very close in time (few miliseconds apart). I am seeing this both on my local machine and staging environment.
I wrote very simple JMeter test case for a Play app that takes a variable in path and prints it in the page that reproduces this issue.
So for request like localhost:9000/123 displays page containing number 123, works for low load, with high load this will be mixed.
Play 2.1.4 (tried also 2.1.0)
Using spring as described there http://typesafe.com/blog/announcing-play-framework-21-the-high-velocit
Using simple authentication (see attached project)
for both play run and play stage
I couldn't reproduce this without the authentication.
Thanks for replies.
|Re: [2.1.4] Play mixing responses under high load||František Hartman||10/2/13 4:25 AM|
I have nailed the issue to my spring configuration.
Problem was that Play asked for instance of play.mvc.Security.AuthenticatedAction (calling the
method. I delegate this to Spring bean lookup. So initially I added
which created only one instance. Following will create new instance each time it is requested
and the issue dissappears. The page http://www.playframework.com/documentation/2.1.1/JavaInjection should be updated with information which beans could be singletons and which not.
|Re: [play-framework] Re: [2.1.4] Play mixing responses under high load||Guillaume Bort||10/2/13 7:42 AM|
It shouldn't be a problem if you keep your controller instances totally stateless. If you keep a state related to a specific request (or set of requests) into the controller, then yes you need a new instance to serve each request.
|Re: [play-framework] Re: [2.1.4] Play mixing responses under high load||Donovan Muller||10/3/13 4:45 AM|
I also stumbled into this the other day...
In my case, the symptom manifested itself when two requests (in this case a request to two different controllers for profile images) were fired off by .js on my page directly after each other.
The two requests would sometimes respond correctly (two distinct images returned) but if you refreshed a few times, you would start finding that one (i.e. the same) image would be returned for both requests.
After some digging, it looked like both requests would be routed to one controller when the same image was returned and not to two separate controllers as expected.
So refreshing would result in a lucky packet of which controllers got what requests. Either requests were routed as expected to both controllers or both requests to either one of the controllers...
I was using action composition to inject the authenticated user:
After I changed the bean scope to SCOPE_PROTOTYPE, all worked as expected...
Springs singleton scope also bit me with Websockets and how I injected things: http://stackoverflow.com/questions/17782901/websockets-with-multiple-tabs-windows
I have since fixed this as well by working around Spring's singleton scope (probably should answer my question :) )
|Re: [2.1.4] Play mixing responses under high load||Anton Ivinskyi||5/4/15 7:01 AM|
Got same issue, responses are mixed in play 2.3.8 with securesocial authentication. How can it be solved? Any help?
|Re: [2.1.4] Play mixing responses under high load||Anton Ivinskyi||5/4/15 8:22 AM|