directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irving, Dave" <dave.irv...@logicacmg.com>
Subject RE: [mina] Writing to an IoSession
Date Tue, 25 Oct 2005 11:27:48 GMT
Hi Trustin,
 
> his sounds great.  
> It would be very great if you can provide us some benchmark results
against 
> Tomcat and Apache HTTPD / Apache HTTPD 2 if you can.  Are you able to
do that 
> for us?  Of course we can run benchmark by ourselves if we can access 
> your HTTP server implementation. 

Its still early days at the moment :o)
Basically, I work on a product which is used as a gateway in some
scenarios (e.g, receive an multi-media message, send it out to another
(off-board) application, and return a response to the original client
when we receive a response from the application.
In this example latency can be high (up to 20 secs per request).

So, what I needed was high-throughput even at high latency.
In tomcat, this means having a very large number of processor threads -
(which can obviously cause scalability problems).

So what Im doing is coming up with a through-and-through asyncronous API
for web applications, and a (NIO driven) web server to host such
applications.

At the moment, its still early days. But I can give you an example of a
test I ran this morning:

 
________________________________________________________________________
___
/          | Client Threadds | Server Threads | Requests |
Requests/second  \
|_______________________________________________________________________
____|
|AsyncWeb  |      50         |      21        | 50,000   |    607
|
|Tomcat    |      50         |      50        | 50,000   |    471
|
\_______________________________________________________________________
____/

Tomcat had a simple Servlet configured which just gave a "hello world"
reply to each HTTP request.
Likewise, AsyncWeb had a simple AsyncHttpService configured which gave
the same "hello world" replies.
No connection keep alives were used (that comes later...).

Question: 

Could you possibly tell me where to look to find out how to control the
number of threads created for processing MINA events? I noticed that I
was receiving call-backs from MINA on 21 threads.... 

> BTW which version of MINA are you using?  
> It seems like you're using only I/O layer.  Am I right?

0.7.4. I read about all the protocol layer stuff - but I don't really
have any need for it at the moment. The io layer simply delegates to the
stateful parsers and gets told when to write to and shut the connection.
I've got my own protocol layer at the moment which controls pipelining,
keep-alives, continue expectations etc. 

Dave
_____________

From: Trustin Lee [mailto:trustin@gmail.com] 
Sent: 25 October 2005 12:00
To: Apache Directory Developers List
Subject: Re: [mina] Writing to an IoSession


Hi Dave,

2005/10/25, Irving, Dave <dave.irving@logicacmg.com>: 

	Im writing an Http server based on Mina. The tutorial was great
and got
	me started in the right direction. I'm using a "stateful" parser
	approach like that used in ASN1 - and it fitted in very nicely.
	Currently, I can ** parse ** around 24,000 HTTP requests per
second - 
	and with multiple (non-HTTP-pipelining) connections, I can
service
	around 700 requests a second. This will improve massively in a
few days
	when I implement keep-alive.
	So - after that background, I first want to say a big thank-you
for 
	MINA. So far, it has proved very stable, and very fast - and
hey, I was
	getting bored of writing selector loops anyway :o)


This sounds great.  It would be very great if you can provide us some
benchmark results against Tomcat and Apache HTTPD / Apache HTTPD 2 if
you can.  Are you able to do that for us?  Of course we can run
benchmark by ourselves if we can access your HTTP server implementation.




	One question I do have: Currently Im holding on to the IoSession
	associated with a request so that when a response becomes
available 
	(asyncronously), it knows where to write it to. I cant see any
other way
	of knowing where a response is destined for.
	E.g, (cut down, sort of psudo-code)
	
	/**
	* Invoked asyncronously when a response is comitted - and ready
to be 
	* written
	*/
	void handleResponse(Request req, Response resp, Object marker) {
	  IoSession session = req.getContext().getSession();
	  ByteBuffer buff = getBufferFor(resp);
	  session.write(buff, marker); 
	}


Yes there's no other way to find out what session is associated with
request right now.  But you could maintain an IdentityHashMap<Request,
IoSession> based on sessionOpened() and sessionCreated() event: 

void handleResponse(Request req, Response resp, Object marker) {
    IoSession session = req2sessionMap.get( req );
    byteBuffer buf = getBufferFor( resp );
    session.write( buf, marker );
}

BTW which version of MINA are you using?  It seems like you're using
only I/O layer.  Am I right?

HTH,
Trustin

-- 
what we call human nature is actually human habit
--
http://gleamynode.net/ 


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

Mime
View raw message