sockets - Netty 4.0 SO_Keeplive one connection send many request to server How to process request concurrently -
one connection send many request server
how process request concurrently.
please use simple example timeserver or echoserver in netty.io illustrate operation.
one way find out create separate threaded handler called in producer/consumer way.
the producer "network" handler, giving message consumers, therefore not waiting wanswear , being able proceed next request.
the consumer "business" handler, 1 per connection possibly multi-threaded, consuming multiple instances messages , being able answer using netty's context connection attached.
another option consumer have 1 handler, still multi-threaded, message come in original netty's context such can answear client, whatever connection attached.
but difficulties come soon:
how deal answear among several requests on client side: let client sends 3 requests a, b , c , answears come back, due speed of business handler, c, a, b... have deal it, , knowing request answer is.
you have ensure ways context given in parameter still valid (channel active), if don't want have many errors.
perhaps best way handle request in order (as netty does), , keep answear's action quick possible.
Comments
Post a Comment