Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Failing to connect with v9.2.2 HttpClient

On 09/02/2014 01:47 PM, Joakim Erdfelt wrote:

Thank you for your response.
You starved the executor / threadpool. Simple enough.
Why do you have such a tiny threadpool to begin with?

The system is running a large number of multithreaded processes, and the HTTP transport isn't the bottleneck. I've found that increasing the number of threads (either with the fixedThreadPool or QueuedThreadPool) that we use for the Jetty Clients starves the other processes in our system and degrades overall performance.
Our threadpool / executor defaults assume reasonable baselines.
Our defaults:
  Executor impl: QueuedThreadPool
  max threads: 200
  min threads: 8
  idle timeout: 60,000 ms
  backed by: BlockingArrayQueue

These are practical limits based on what is considered a modern baseline from 2010.
Suitable for limited devices of the day (such as J2ME, Raspberry Pi, and Android)
These defaults also perform splendidly for larger systems as well.

Your FixedThreadPool executor is a premature optimization that is harming you.
I found that the using the QueuedThreadPool defaults solved the deadlock issue from not creating sockets to the destination (and zero traffic being sent from the box), however once that was corrected, I found that the defaults don't work well with our system.  Moving back to a FixedThreadPool (with more threads than used for the ClientSelectorManager) increased our performance.

If I wanted to change the number of selectors, it looks like I could call the HttpClientTransportOverHTTP constructor with the number of selectors, and pass that into the HttpClient constructor.
int numSelectors = 8;
HttpClientTransport transport = HttpClientTransportOverHTTP(numSelectors);
HttpClient httpClient = HttpClient(transport, null);

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top