Is Netty what I'm searching for?
Johnny Luong
johnny.luong at trustcommerce.com
Wed Jun 16 14:20:45 EDT 2010
1) There are multiple stock protocol encoders and decoders. If you need
something more specific, you can override FrameEncoder/FrameDecoder to
construct/parse your custom protocol from/to POJO.
2) How you dispatch your POJOs to handlers will probably determine
whether it meets your needs. If your concerned about latency, check out
the Echo example which will tell you the round trip time between the
client/server for echoing a message -- thats as basic as it gets. If
your concerned about concurrency, you may need to employ more
sophisticated constructs like an ExecutionHandler.
Nicholas Hagen wrote:
> I'll let others answer the questions more in depth but as a personal
> testimonial this type of setup was precisely what I was planning for a
> gaming engine. I did the investigation but never got to actual coding :
> ( Nonetheless Netty clearly made sense for both its simplicity and its
> performance including latency. There are handlers available to easily
> read and write bytes off the frame. My setup was going to use one of
> the LengthField framers to frame packets into complete packets
> followed by a translator handler that would read and write the ints,
> strings, etc and store into command POJO classes. Those POJOs would
> then be sent up the stream to be processed by a command handler which
> would actually process the command accordingly. Depending on the
> situation you may also front that with the executor based handlers for
> longer running commands.
>
> In terms of your thread issues with the rooms, it is possible it will
> hurt latency due to the thread contention between worker threads and
> your room threads. Depends what those threads due I guess. If anything
> make sure the room threads run at lower priorities or occassionally
> yield in expensive loops. Netty will still perform better thread wise
> than an older blocking IO library.
>
> Another idea if push came to shove would be to have an external
> service run the room threads and the required processing and use a
> distributed library or cache to keep the systems in sync. Then it's
> just short bursts of IO rather than expensive processing threads.
>
> Nicholas Hagen
> Z|NET Development, LLC
> www.znetdevelopment.com/blogs
> * sent from my iPhone *
>
> On Jun 16, 2010, at 8:05 AM, Johan3 <hari97 at mymail.fi> wrote:
>
>> Hello everyone, I'm a newbie user of Netty. I've tried out couple
>> frameworks
>> which were not able to offer me what I need, so I got couple
>> questions about
>> Netty. I've checked out the comments about Netty and also tried out
>> few
>> code-examples, and I'm pretty optimistic about this.
>>
>> I have a online Java game project, and the server should be able to
>> handle
>> about 2000-3000 clients, but it's a game where low latency is really
>> important - every millisecond counts. Is Netty able to handle those
>> clients
>> without "lag"? Some frameworks offers many great features (still
>> useless for
>> me), and it causes unwanted latency.
>>
>> If Netty is the right choice for me, could you also give some
>> advices to
>> newbie... These things are on my mind:
>>
>> 1: My game should sends packets and encode (and decode) packets for
>> example
>> like following:
>> byte whatMessageItIs, int SomeNumber, boolean true, int type, String
>> message
>> So does Netty provide a simple way to do this, encode and decode a
>> packet
>> where the first byte is some kind of a type of the message. In the
>> guide
>> there's many kind of handlers, encoders and decoders added to
>> pipeline, but
>> is this kind of a simple messaging system enough or am I missing
>> something?
>>
>> 2: I also got to make rooms to the game, every room has a running
>> thread
>> (which moves players). I'm wondering, how to make it right for Netty,
>> because running threads causes maybe most stress to server.
>>
>> 3: Also, I have done this kind of a server before. How much should I
>> use
>> Netty's elements in basic server-system, is it ok to use just Netty's
>> messaging system as a base, and do everything else by myself, or
>> should I
>> always use Netty's elements?
>>
>> Regards
>> Johan
>> --
>> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Is-Netty-what-I-m-searching-for-tp5186104p5186104.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
More information about the netty-users
mailing list