Saturday, July 14, 2012

Scaling in BlazeDS to support multiple clients

We all know about the messaging limitations for many client in BlazeDS. It can support few hundred clients (documentation mentions few hundred, only god know the exact number).For messaging purpose BlazeDS creates one queue to per client connected to it. It uses one server thread for one client. In BlazeDS if a client is using streaming channel or a long polling with long waiting interval, all available server threads can get blocked and the new client request cannot be fulfilled. In that case the client won't be able to connect. As BlazeDS is servlet based and we can not have a server with thousands of free threads, it becomes a bottleneck while we need to support thousands of clients for messaging. In LCDS, it makes use of NIO based endpoints where it does not use that blocking a thread funds. New servers are coming up with servlet 3.0 specifications and are supposed to resolve this problem.

The following excerpt is taken from here.
Blaze-DS can support hundreds of users (not thousands), this is because the limitation is with its use of Servlet API. An any web-server has limited number of threads. Messaging with Blaze-DS is particularly nasty, as the server will be bombarded with polling requests(as in case of ordinary http polling), or the server threads will be occupied (as in case of long http polling). 

LCDS also has a similar limit. But it supports RTMP, which can be more scalable - but it does not use http, and uses non-standard port (2038?) - this means it will be blocked by firewalls and therefore not usable usually. But for polling requests (ordinary or long polling), it is more scalable than Blaze-DS because it does not use web-server threads for its functioning (instead using what is called Java NIO). Even here, it can support users in thousands (and not in millions etc) - which may be ok. 



You can read about the scaling limitation and work going on in this direction at the following links:

http://blog.hiraash.org/2012/04/13/scaling-blazeds-with-servlet-3-concurrency/
http://www.dan-menard.com/tag/blazeds/



1 comment:

Anonymous said...

Hey Akhil,
Can u post something about creating custom components in ActionScript by overriding createChildren() etc methods.
And what is the purpose of overriding these methods?

Regards
Flex Lover