Praveen Balaji wrote:
Thanks Sebastiaan. I came to about the same conclusions
as you listed out here. I also saw your post on parsing POST parameters and I 
think
it's going to create problems for me as well!



I am unsure the API would be "improved". I
simply think, as Filip pointed out earlier, what we want to use is Async
servlets and Comet is not intended to solve the same problem.
this is work in progress, and probably, you'd be able to do it using the same API.
check in on the dev list

Filip


Let's see what I can come up with!

Praveen

----- Original Message ----
From: Sebastiaan van Erk <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Wednesday, May 2, 2007 11:19:29 AM
Subject: Re: Comet and Async Servlets - Architecture Question

Praveen Balaji wrote:
The
last few days I have been evaluating using CometProcessor to work like an
Async Servlet for me. I pick up the CometEvent object on BEGIN event and
process the whole request asynchronously. When I am done, I close the I/O 
stream.
I
would like to know what the Tomcat developers and the developers in general
think about this approach. Is it a misuse of the API to process requests
asynchronously, outside of the event method? Are there any issues that I should 
be cautious about? Synchronization issues?


See the mailing list archive of the last month and filter on "comet". There have been quite a few posts on exactly this subject.

There are multiple issues:

1) Closing the I/O stream (on the response) does not end the request/response. It takes another 30-60 seconds before the event method gets called with an END event leaving a lot of request open unnecessarily.

2) Nothing is synchronized in Comet, so you have to do all synchronization yourself. You have to make sure that you do not write to the output stream after the event is closed (even though you may still have the reference in your asynchronous application code). I seem to have eliminated most issues by synchronizing access to the response output stream and using the same lock around the event.close() method in the event() method of the CometProcessor. However I still very sporadically get a ClientAbortException/ClosedChannelException which suggests that I've missed a place where synchronization is necessary. It might not be possible to synchronize this though, because it could happen deep inside Tomcat. The API has no information about what to synchronize for asynchronous use.

3) If you rely on the POST method to send parameters to your CometProcessor, then you have to parse the parameters yourself; there is an issue that doing getParameter() on the request in the BEGIN event may return null because the request body has not yet been received by the server at the moment of the getParameter() call.

One of the Comet developers (Remy) suggests that it might be better to just use normal servlets and buy some extra memory for the extra threads.

As far as the current API goes, I would say it is probably a "misuse", though I would very much like to see the API improved so that this is no longer the case.

Regards,
Sebastiaan

Thanks,
Praveen Balaji.




__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.6.2/785 - Release Date: 5/2/2007 2:16 PM


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to