Skip to content

Commit

Permalink
Use at least 8 threads in Jetty thread pool (apache#3776)
Browse files Browse the repository at this point in the history
### Motivation

Use at least 8 threads to avoid having Jetty go into threads starving and
having the possibility of getting into a deadlock where a Jetty thread is
waiting for another HTTP call to complete in same thread.

This solve the issues of requests timing out when the broker is making REST
calls to itself. Such examples are when running in standalone mode and 
creating a function.
  • Loading branch information
merlimat authored and sijie committed Mar 7, 2019
1 parent c13242f commit 7a9f7f3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ public class ServiceConfiguration implements PulsarConfiguration {
doc = "Number of threads to use for HTTP requests processing"
+ " Default is set to `2 * Runtime.getRuntime().availableProcessors()`"
)
private int numHttpServerThreads = Math.max(4, 2 * Runtime.getRuntime().availableProcessors());
// Use at least 8 threads to avoid having Jetty go into threads starving and
// having the possibility of getting into a deadlock where a Jetty thread is
// waiting for another HTTP call to complete in same thread.
private int numHttpServerThreads = Math.max(8, 2 * Runtime.getRuntime().availableProcessors());

@FieldContext(
category = CATEGORY_WEBSOCKET,
Expand Down

0 comments on commit 7a9f7f3

Please sign in to comment.