Fwd: How to handle server throttling client connections and HTTP 503 "Service Unavailable"

Tim McCauley nettytim at gmail.com
Thu Nov 18 09:42:31 EST 2010


I am new to Netty and have found the API and Java docs to be very good.

I am trying to put a server together that has two Http web servers in one
JVM.  The first server will have up to 200k + clients connected to it and
they must stay connected all the time, using Https.  The server has a
RESTFUL protocol and one of the messages the clients will send is a simple
GET with no content ever 95 to 120 seconds which will keep the connection
alive.  Then the clients will also send data in a JSON payload when
necessary.  The clients when connecting to the first server register with it
using a unique id that the client and the second sever uses to communicate
with it.  So in the first server on initial contact it creates a mapping
from the clients unique id and the channel id.  The second server also uses
a REST protocol and some of the messages result is sending messages
connected to the first server.  The second server uses the Channel to unique
id mapping that was created on initial registration with the first server
and the second server handler gets that Channel and writes the message to
the client.

I have a few question:

1) Will Netty be able to handle have 200K+ clients connected to a server
socket and remain open all the time?

2) Is it correct for the second server to get the Channel on the first
server to send message to the connected clients?

3) How can clients being connected to the server be throttled?  What I mean
is if say 10K clients all try to connect to the server how can an Http 503
"Service Unavailable" be communicated back to the client?

I see when creating the NioServerSocketFactory that both the boss and worker
Executors are passed and there is an optional number of worker threads.  The
docs are a little unclear as to how the optional number of worker threads
works and what happens when they are all used up.  When all the worker
threads are used up what will Netty do.

Great API

Tim McCauley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20101118/0102302e/attachment.html 


More information about the netty-users mailing list