Torque
Torque

Reputation: 3584

Webservice restricted to a single thread?

Today, while testing some code that was slow (had to wait for data from a slow source) in a RESTlet, I noticed that Wildfly would not allow me to start additional threads, and would only run the RESTlet itself in a single thread as well, meaning multiple connections had to wait for the previous one to finish.

Oddly enough, even using a ManagedExecutorService, configured through the urn:jboss:domain:ee:3.0 subsystem to allow for more threads would still be limited to spawning one new thread, which then worked off the requests sequentially.

Have I misunderstood how that subsystem is supposed to work ? Or is this a restriction to the RESTEasy aspect somehow ? I have in the past used normal WebServlets with concurrency without experiencing this behavior.

Upvotes: 0

Views: 496

Answers (1)

user140547
user140547

Reputation: 8200

Maybe your problem is on the client side. How do you test your code? I have tried to access some REST Service in Wildfly 8.2 by putting a Thread.sleep(5000) in some method. If I, for example, open two tabs in Firefox or Chrome, only one request is processed concurrently, and it takes 10 seconds . However, using Firefox and Chrom in parallel, they both get the response in 5 seconds.

Upvotes: 2

Related Questions