users@grizzly.java.net

Newbie: preliminar clarifications

From: Matteo Mazzotti <m.mazzotti_at_p-tel.it>
Date: Sat, 21 Jun 2008 12:44:09 +0200

Hi all,
I've come across your framework more or less by chance.
I've read some blogs about it and some tutorials, but I need a final
clarification from you on whether this is actually the right framework for
my use case.

I have to (re)write a TCP server (no HTTP) that is able to serve hundreds of
clients at the same time.
What is not clear to me is whether Asynchronous and permanent connections
(which is what I need) are two contradictory terms, that is if one must
choose between one approach or the other.
I need a permanent connection because the client must be pushed data by the
server (I'd say asynchronously, as the updates sent by the server don't
necessarily follow a client request).

At the moment, my server implementation is based on the old
thread-per-connection paradigm, which I understand is a wasteful approach
and doesn't scale up. So the thread-per-event seems to be the right one
here.
Aother question: in the thread-per-event solution, a thread pool is used to
take a thread from the pool, serve an event, "wake up" the appropriate
Handler (which is a thread too), then go back to sleep waiting for a new
event. If a Handler is a thread, and I have a Handler per client, in the end
I still have a thread per connection, so what's the key difference ? Am I
missing something here? (maybe there can be a thread pool for Handlers too?)


Thank you in advance,
Matteo

Ps: I'm from Italy and I couldn't find any resource on grizzly on the
Italian blogosphere. I think I'll blog about it as soon as I get
knowledgeble enough