You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by anas Ahmed <an...@msn.com> on 2009/04/03 08:45:03 UTC

[GSOC] Filters & Async Support in Servlet 3.0

Hello all,
As i have  read from Servlet 3.0 specification about filters "A Filter and the target servlet or resource at the end of the filter chain must execute in the same invocation thread".

This mean if there are many Async Requests which are connected to filters, many filters will be init but  not destroyed until response come back or filter work finish.
As we know Tomcat uses thread per request through Java NIO.
More simultaneous requests(connected to filters) cause more threads to be consumed, which cancels out the benefit of the thread-per-request approach to a high degree.

This is my understanding  please correct to me if there are mistake?
Anas Ahmed

_________________________________________________________________
Rediscover HotmailĀ®: Get e-mail storage that grows with you. 
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Storage1_042009

Re: [GSOC] Filters & Async Support in Servlet 3.0

Posted by Mark Thomas <ma...@apache.org>.
Mark Thomas wrote:
> Anas Ahmed wrote:
> 
>> I wrote proposal for the second project "improve the JMX  support within Apache Tomcat"
>> i'm waiting for your feedback 
>> and i need your advice about which project i have to put my focus because i'm student and the time is valuable  
> 
> My suggestion (but it is only a suggestion) is that you focus on the JMX
> proposal.

And if you haven't seen, I have asked you for some additional
information. You should be able to add it as a comment to your proposal.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [GSOC] Filters & Async Support in Servlet 3.0

Posted by Mark Thomas <ma...@apache.org>.
Anas Ahmed wrote:

> I wrote proposal for the second project "improve the JMX  support within Apache Tomcat"
> i'm waiting for your feedback 
> and i need your advice about which project i have to put my focus because i'm student and the time is valuable  

My suggestion (but it is only a suggestion) is that you focus on the JMX
proposal.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [GSOC] Filters & Async Support in Servlet 3.0

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Anas Ahmed wrote:
> Two Scenarios of thread per request :-
> 1- if the request send  directly to server without filter:-
> When a connection is idle between requests, the thread can be recycled, and the connection is
>                         placed in a centralized NIO select set to detect new requests without consuming a separate thread.
>   
the new async behavior in Servlet 3.0 is not related to the underlying 
IO technology.
It has nothing to do with NIO or blocking IO. We should be able to 
implement it using BIO without any issues, since its not IO bound.

Filip
> 2- if the request chain to filter :-
> when a connection is idle between requests , the thread is still allocated to the particular request since the servlet 3.0 specification says :"A Filter and the target servlet or resource at the end of the filter chain must execute in the same invocation thread"
> It is look like thread per connection.
>   

>  if that is false 
> what do you understand from this sentence :"A Filter and the target servlet or resource at the end of the filter chain must execute in the same invocation thread" ??
>
> I wrote proposal for the second project "improve the JMX  support within Apache Tomcat"
> i'm waiting for your feedback 
> and i need your advice about which project i have to put my focus because i'm student and the time is valuable  
> Anas 
>
>
>
> _________________________________________________________________
> Quick access to your favorite MSN content and Windows Live with Internet Explorer 8. 
> http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0701A
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


RE: [GSOC] Filters & Async Support in Servlet 3.0

Posted by Anas Ahmed <an...@msn.com>.
Two Scenarios of thread per request :-
1- if the request send  directly to server without filter:-
When a connection is idle between requests, the thread can be recycled, and the connection is
                        placed in a centralized NIO select set to detect new requests without consuming a separate thread.

2- if the request chain to filter :-
when a connection is idle between requests , the thread is still allocated to the particular request since the servlet 3.0 specification says :"A Filter and the target servlet or resource at the end of the filter chain must execute in the same invocation thread"
It is look like thread per connection.

 if that is false 
what do you understand from this sentence :"A Filter and the target servlet or resource at the end of the filter chain must execute in the same invocation thread" ??

I wrote proposal for the second project "improve the JMX  support within Apache Tomcat"
i'm waiting for your feedback 
and i need your advice about which project i have to put my focus because i'm student and the time is valuable  
Anas 



_________________________________________________________________
Quick access to your favorite MSN content and Windows Live with Internet Explorer 8. 
http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0701A

Re: [GSOC] Filters & Async Support in Servlet 3.0

Posted by Mark Thomas <ma...@apache.org>.
anas Ahmed wrote:
> Hello all,
> As i have  read from Servlet 3.0 specification about filters "A Filter and the target servlet or resource at the end of the filter chain must execute in the same invocation thread".
> 
> This mean if there are many Async Requests which are connected to filters, many filters will be init but  not destroyed until response come back or filter work finish.

My understanding is that the filter processing in the outbound direction
will take place after the Servlet completes (without generating a response).

The filters will not have to wait until the Async processing completes.
However, any wrappers they put in place may have to remain until the
async processing completes.

> As we know Tomcat uses thread per request through Java NIO.
Tomcat uses one thread per request for BIO, NIO and APR/native.
The differences are with connections where BIO uses 1 thread per
connection (including those in keep-alive) whereas NIO and APR/native
use polling threads that each maintain a number of connections.

> More simultaneous requests(connected to filters) cause more threads to be consumed,
More concurrent requests does equal more threads but the number of
filters is not a factor.

> which cancels out the benefit of the thread-per-request approach to a high degree.
Given the number of filters is not a factor, I don't think this is the case.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org