The Source for Java Technology Collaboration

Home » java.net Forums » GlassFish » GlassFish

Thread: Questions about grizzly

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Last Post: Oct 31, 2007 6:54 AM by: Jeanfrancois Ar...
coolnight

Posts: 1
Questions about grizzly
Posted: Oct 31, 2007 12:54 AM
 
  Click to reply to this thread Reply

I am reading code of grizzly 1.6, and I have several questions.

1) if I use grizzly, I have to deal with nio detail?
If this is true, it sounds bad!

2) I am wondering how to write a high performance Echo server with grizzly.
I read the code of EchoFilter, I found that it supposed that I use thread pool !
In EchoFilter, it calls OutputWriter.flushChannel to write data to client. But OutputWriter.flushChannel will block at select method.
if there are some slow clients,each slow client will block one thread, it's easy to make
all threads blocked!

3) For checking key timeout, after select method called and ready keys dealed with, Controller
will check whether there are any keys of the selector timeouted.
But if there are thousands of clients, this check will take some time, how can the server be of high performance?

Jeanfrancois Ar...
Re: Questions about grizzly
Posted: Oct 31, 2007 6:54 AM   in response to: coolnight
  Click to reply to this thread Reply

Hi,

let's move the discussion on the proper mailing list:

users@grizzly.dev.java.net

coolnigh, can we continue the discussion on the grizzly users list?

glassfish@javadesktop.org wrote:
> I am reading code of grizzly 1.6, and I have several questions.
>
> 1) if I use grizzly, I have to deal with nio detail?
> If this is true, it sounds bad!

Yes and no depending on what you want to do. The bytes read are always
available inside a ByteBuffer. So if you need to parse the bytes, yes
you have to interact with NIO objects. Grizzly take cares of the low
level handling, but your ProtocolFilter always have to interact with
byte buffers....

>
> 2) I am wondering how to write a high performance Echo server with grizzly.
> I read the code of EchoFilter, I found that it supposed that I use thread pool !
> In EchoFilter, it calls OutputWriter.flushChannel to write data to client. But OutputWriter.flushChannel will block at select method.
> if there are some slow clients,each slow client will block one thread, it's easy to make
> all threads blocked!

Right the EchoFilter is an example. You aren't forced to use the
"blocking" OutputWriter, but you will have to write your own NIO code.
Release 1.6.2 will have an asynchronous write mechanism for application
that don't want to use the OutputWriter.

This feature is very often asked. If you join the Grizzly dev list, you
will see that we have started discussing how we want to efficiently
support async write.

>
> 3) For checking key timeout, after select method called and ready keys dealed with, Controller
> will check whether there are any keys of the selector timeouted.
> But if there are thousands of clients, this check will take some time, how can the server be of high performance?

I don't think the operation reduce significantly performance (at least
for the http case, we never found it was a bottleneck). But we have made
the strategy pluggable, so you can always inject your own (or disabled it).

Thanks!

-- Jeanfrancois


> [Message sent by forum member 'coolnight' (coolnight)]
>
> http://forums.java.net/jive/thread.jspa?messageID=243052
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net





 XML java.net RSS