Does long polling have connections limit?

I am developing a Play 1.2.4 application using long polling, similar to the chat example. I have been doing load tests with JMeter and when I have more than 300 listeners my server needs more than 4 seconds to answer, which is too much for my needs, or the listener never receives the answer. I need to get all the responses in less than a second.

Does long polling have connections limit? Do I need a special configuration or server?

Thanks in advance,


No special configuration needed, it's just a matter of CPU/RAM on your server plus how long does it take to process the controller call (how many requests to DB, etc).

As Play is stateless, if you are getting timeouts, just try to add a second server behind a load balancer and that should solve the issue.

Edit on comments:

The main issue you are having is that Play takes long to propagate the events to 300 users. That's kind of expected, as the Chat sample uses an in-memory system to do the propagation, passing the message sequentially to each subscriber.

There is another with the Chat approach: if you were to use a second server, the messages won't be shared between them, as the ArchivedEventStream is stored locally in the Play instance JVM.

If you want more performance you need to move the publish/subscribe step to an external Message Queue tool, like Redis. This will have the benefit of letting you add extra instances while sharing the same messages across them.

It does not sound like you are reaching a connection limit for long polling on your Play server. Rather, you are probably reaching some form of bottleneck which is causing response times to degrade.

A strong possibility is that you are reaching a limit on the machine that is executing the JMeter test, the chances of this increase if you are running in GUI mode. You can verify if this is the case or not by using multiple machines to repeat the test, simply execute the same test on two machines at the same time, if they both show identical results to when only one test is running then logially the problem is not your Play server but the test itself. If, however, you see worse results with two tests running, then the problem is with your server. Remember to use a ramp up time, this will help identify the point at which things start to slow down which is useful for tuning.

If you are reaching a JMeter limit then try running from the command line, this is much more efficient or, if you really want the interface, then try using less listeners, these are the things which cause problems.

Need Your Help

MySQL Query optimisation for fetching geolocation records

php mysql performance pdo query-optimization

I have a geolocation of a place means i have one CenterLatitude and CenterLongitude and a radius. Within this radius there is lot of region records with different kind of RegionType. I want to fetc...

Looking for BeanShell Validator plugin for Eclipse

eclipse eclipse-plugin beanshell

I have inherited a Java WebApp that contains the majority of its business logic in a 16K line BeanShell File.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.