Serving images over http using Netty

Drew Kutcharian drew at venarc.com
Tue Jun 21 01:52:31 EDT 2011


Hi Trustin,

Thanks for the quick reply. 

What other things should I consider for performace? Is the static file server example production quality (considering the Netty configuration) or is it purely a simple example?

Thanks again,

Drew

On Jun 20, 2011, at 10:16 PM, "이희승 (Trustin Lee)"<trustin at gmail.com> wrote:

> Drew Kutcharian wrote:
>> Hi Everyone,
>> 
>> I would like to know what's the best way to serve images that are hosted in a document database using Netty.
>> 
>> I'm new to Netty and I started looking at the the HttpStaticFileServer, but I don't think that would be a good example since, it uses RandomAccessFile and does a lot of "file dependent" things.
>> 
>> I will only be sending small images, so I was thinking I can just read the whole byte[] from the DB and then use Netty to send it to the user.
>> 
>> What is the fastest/optimized way to do this? How should I configure Netty? What should I include in the pipeline? What kind of ServerSocketFactory and ThreadFactory should I use?
> 
> Then you can just wrap the byte[] with ChannelBuffer and write it into a 
> Channel.
> 
>> In addition, how should I handle the database connection?
> 
> In a separate thread pool.  You could use an ExecutionHandler or create 
> your own thread pool and submit tasks to it so that the tasks that take 
> long time are run in a different thread than an I/O thread.
> 
> HTH
> 
> -- 
> Trustin Lee, http://gleamynode.net/
> 
> _______________________________________________
> 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