views:

42

answers:

1

Hello,

I recently switched my web application from running via an embedded Jetty instance to a standalone Tomcat instance. Everything is mapped appropriately, and Tomcat begins to serve up content.

However, my application makes about 20 AJAX POST requests at once to the server (to load various page elements). This worked fine on Jetty, however Tomcat services the first few, then returns the following response for the next one or two:

Server: Apache-Coyote/1.1
Content-Length: 0
Date: Fri, 09 Jul 2010 02:13:37 GMT

And then continues servicing requests, returning "blank" responses every 3rd or 4th request. I dont think its a problem with the way the request is being handled, since a) it works on Jetty and b) on refreshing the page, some requests that didnt complete before complete, and some that did complete before no longer complete.

I am wondering if Tomcat is unhappy that it is being bombarded with many requests from the same IP in the same second. Does anyone know how to fix this?

EDIT: I believe the issue is related to threading. If I make my servlets implement SingleThreadModel, the issue goes away (of course this is deprecated and sub-optimal, I will try and figure out where the real issue is). I believe the reason why it worked in Jetty was because I was using an embedded Jetty instance (as opposed to a standalone Jetty instance), which must have only been using a single thread inside my Application.

A: 

EDIT: I believe the issue is related to threading. If I make my servlets implement SingleThreadModel, the issue goes away

Likely you're assigning request and/or session scoped data as instance variable of the servlet.

See also:

BalusC