Skip to main content

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

Hi again and thanks for the reply!

This seems to do just what I need. My problem is in how to use the QoSFilter as we are using Jax-WS as "black box" framework.


Server server = new Server(5050);
HandlerCollection baseCollection = new HandlerCollection();
server.setHandler(baseCollection);
 {
   MyRequestLogHandler logHandler = new MyRequestLogHandler();
   baseCollection.addHandler(logHandler);
}

// Initialize and add Filter here somehow so it is called before the ContextHandlerCollection

{ // Handler that later calls the JaxWS Services
   ContextHandlerCollection jaxwsHandler = new ContextHandlerCollection();
   baseCollection.addHandler(jaxwsHandler);
}

JettyHttpServerProvider.setServer(server);
		  
endpoint = Endpoint.create(webService);
endpoint.publish(address);

try {
   server.start();
   server.join();
} catch (Exception e) {
   LOG.error("Error starting jetty",e);
}


I'm trying out different ideas (ServletHandlers, ServletContextHandlers, ...) but with little success so far.
Any tips in how to create, configure and use the Filter in this case?

Thanks,
Max Ulinger

________________________________________
Von: jetty-users-bounces@xxxxxxxxxxx [jetty-users-bounces@xxxxxxxxxxx] im Auftrag von Jesse McConnell [jesse.mcconnell@xxxxxxxxx]
Gesendet: Montag, 2. Mai 2011 19:46
An: JETTY user mailing list
Betreff: Re: [jetty-users] Allow only a single client to send requests to jetty at a time

Perhaps something along the lines of this?

http://wiki.eclipse.org/Jetty/Reference/QoSFilter

cheers,
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx



On Mon, May 2, 2011 at 05:55,  <Max.Ullinger@xxxxxx> wrote:
> 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
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top