[Cosmo-dev] Tomcat 6 Benchmarks

Bobby Rullo br at osafoundation.org
Wed Mar 14 10:11:58 PST 2007


I agree. But it's not necessarily the job of the container to take  
away that pain. Programming with servlets and JSP's is "painful" but  
other people came up with stuff like JSF, Struts, Spring MVC,  
etcetera ad nauseum. So while the Tomcat folks might come up with  
some nicer abstractions, I think we're more likely to see frameworks  
built up around the CometProcessor in other projects which provide  
these nice API's.

However as far as I can tell, programming using this model will  
always be a bit more complicated than what we're used to. In the  
thread-per-request model we're used to, it's perfectly fine to wait   
for blocking calls (say a database query) to come back in your thread  
because you know you're not affecting anyone else. But in the async  
model any time you want to do anything that takes a non-deterministic  
or "long" amount of time you have to instead throw it on another  
thread and give it a callback and return immediately.

I am sure that you can simplify this process to a degree but in this  
model you will never see code that looks like this:

...
//calls the db down the chain...
User user = service.getUser(id);

//now do stuff with user
doStuff(user);
...

Instead might look more like this:

...
Deferred deferred = service.getUser(id);
deferred.addCallBack 
(someObjectWhichImplementsACallbackImplementationSinceFunctionsArentFirs 
tClassCitizensInJavaWhichMakesThisProgrammingModelMoreAnnoyingThanItShou 
ldBeButHopefullyThisWillBeBetterInOneDotSix);
...

I cannot see anyway around having your execution flow broke up all  
over the place. Any Twisted geniuses have any insight into this?

Bobby

On Mar 14, 2007, at 9:09 AM, Brian Moseley wrote:

> On 3/14/07, Bobby Rullo <br at osafoundation.org> wrote:
>> Seeing NIO made me immediately  think of Comet and low and behold
>>
>> http://tomcat.apache.org/tomcat-6.0-doc/aio.html
>
> this programming model seems a little too complex. i hope that over
> time it will be simplified. concurrency is hard, but i feel like the
> container should be able to take away a little more of the pain.
> _______________________________________________
> cosmo-dev mailing list
> cosmo-dev at lists.osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/cosmo-dev



More information about the cosmo-dev mailing list