Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Allow only a single client to send requests to jetty at a time

Hello Jetty users,

I have a problem which I thought would be pretty easy to solve, but haven't found a solution yet.

We are using Jetty as http-server for our JAX-WS  webservice implementation. This is for an embedded system with low hardware performance (relatively speaking), e.g. only 96 MB of memory for the JVM heap.
We have several 100k of log entries which can be returned by the service. Creating the XML and streaming the content to the client in the JAX-WS Framework explodes the used memory. In the worst case, the JVM runs out of memory when two clients request a lot of data at the same time.

Now, I want to configure Jetty to only allow a single client to call a service at any given time. A second request should wait until the first request was completely streamed and finished.
This must probably be done on the lowest level, e.g. the socket/streaming level.

The services themselves are already 'synchronized'. I tried manipulating the ThreadPool, but without satisfactory results(using a Thread count <4, parallel requests would hang and not be serviced at all, using a higher Thread count, I had my original problem again).
 I tried working with (synchronized) Handlers, but would still get OOM errors (expectedly, because it is too high in the stack and not on socket level). I did not find a way to configure the connectors to only allow a single request to be serviced at a time.

I am using:
<dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-j2sehttpspi</artifactId>
      <version>7.3.1.v20110307</version>
</dependency>

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-server</artifactId>
    <version>7.3.1.v20110307</version>
</dependency>


Is there any way to configure Jetty to only service a single request at a given time?

I would be very happy for a solution or pointers in the right direction.

Regards,
Max Ullinger


Back to the top