New to netty

manish_iitg excellencetechnologies08 at gmail.com
Mon Dec 8 07:54:54 EST 2008




Hello,

Thanks for the reply . I will surely try out the execution handler. I am
writing a complex application on Netty and will keep posting my doubts here,
I hope they are answered here. Also will surely give a feedback after i have
used Netty to some extent. Till now i found netty great. The basics are
pretty easy to learn. The quick start guide and documentation are excellent.
If only there were more examples on the complex implementation of netty,
then it would be great. 

There should be an option for netty users to post their codes so that rest
of the people can see how people implement netty on various problems.

Thanks for your reply again, will try out your suggestion.




Trustin Lee-2 wrote:
> 
> Hello,
> 
> On Mon, Dec 08, 2008 at 01:37:40AM +0900, manish_iitg wrote:
>> 
>> Hello,
>> 
>> I am new to netty. This is my first time with any NIO Frameworks. After
>> searching on the internet, i found out netty was the best nio framework
>> so
>> decide to build my application on netty. 
> 
> Thanks for choosing Netty first of all, and I'd love to hear your feed
> back!
> 
>> I am creating a application, in which my netty server need to query a
>> mysql
>> database depending upon the request from the client. My client is a swing
>> application, and it send an request object to the netty server. I am
>> using
>> ObjectEncoder and ObjectDecoder for encoding and decoding the request
>> object. On the server side, i have written a simple handler, and in the
>> the
>> messageRecieved function i query the database according to the request
>> object and reply back. In database querry in is simple select function
>> which
>> is called from a static class. 
>> 
>> I want to know weather this architecture is good enough, if the number of
>> request increase. Also what would be the best architecture for such kind
>> of
>> application.
> 
> You are pretty close to prefection IMHO.  One left thing I can think of
> is to add an ExecutionHandler (org.jboss.netty.handler.execution) to the
> pipline.  By adding an ExecutionHandler which wraps a OrderedMemoryAware-
> ThreadPool (org.jboss.netty.handler.execution), you can make your
> handler to process the events in a different thread pool than the I/O
> thread pool.  Because you are performing a time-consuming task which
> might block the I/O thread, it is recommended to add an ExecutorHandler
> somewhere between the head of the pipeline and your handler that queries
> MySQL.
> 
> The following is a simple example that adds an ExecutorHandler as
> explained above:
> 
>   bootstrap.getPipeline().addLast("executor", new ExecutionHandler(
>       new MemoryAwareThreadPoolExecutor(16, 0, 0)));
>   bootstrap.getPipeline().addLast("handler", handler);
> 
> HTH,
> 
> -- 
> Trustin Lee, Principal Software Engineer, JBoss, a division of Red Hat
> --
> what we call human nature in actuality is human habit
> --
> http://gleamynode.net/
> 
>  
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
> 
> 

-- 
View this message in context: http://n2.nabble.com/New-to-netty-tp1625621p1628914.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list