Skip to content

Commit

Permalink
Tweak parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Jul 19, 2022
1 parent cc42960 commit ee303d9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Proteus Changelog.
## Unreleased
### No issue

**Add graceful shutdown option.**


[cc429604e4feaa6](https://github.com/noboomu/proteus/commit/cc429604e4feaa6) Joshua Bauer *2022-07-18 20:30:03*

**Bump version**


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xnio.Options;
import org.xnio.Xnio;
import org.xnio.XnioWorker;

Expand Down Expand Up @@ -412,11 +413,13 @@ public void buildServer()
httpPort = Integer.parseInt(System.getProperty("http.port"));
}

final int processorCount = Runtime.getRuntime().availableProcessors();

Undertow.Builder undertowBuilder = Undertow.builder().addHttpListener(httpPort, config.getString("application.host"))

.setBufferSize(Long.valueOf(config.getMemorySize("undertow.bufferSize").toBytes()).intValue())
.setIoThreads(Runtime.getRuntime().availableProcessors() * config.getInt("undertow.ioThreadsMultiplier"))
.setWorkerThreads(Runtime.getRuntime().availableProcessors() * config.getInt("undertow.workerThreadMultiplier"))
.setIoThreads(processorCount * config.getInt("undertow.ioThreadsMultiplier"))
.setWorkerThreads(processorCount * config.getInt("undertow.workerThreadsMultiplier"))
.setDirectBuffers(config.getBoolean("undertow.directBuffers"))
.setSocketOption(org.xnio.Options.BACKLOG, config.getInt("undertow.socket.backlog"))
.setSocketOption(org.xnio.Options.REUSE_ADDRESSES, config.getBoolean("undertow.socket.reuseAddresses"))
Expand All @@ -430,6 +433,7 @@ public void buildServer()
.setServerOption(UndertowOptions.MAX_BUFFERED_REQUEST_SIZE, config.getInt("undertow.server.maxBufferedRequestSize"))
.setHandler(handler);


if (config.getBoolean("undertow.ssl.enabled"))
{
try
Expand Down
6 changes: 3 additions & 3 deletions proteus-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ undertow
socket {
backlog=10000
reuseAddresses=true
readTimeout=30000
writeTimeout=30000
readTimeout=90000
writeTimeout=90000
}


Expand All @@ -197,7 +197,7 @@ undertow

# x AvailableProcessors
ioThreadsMultiplier=2
workerThreadMultiplier=10
workerThreadsMultiplier=10
bufferSize=16k
directBuffers=true
}
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public ServerResponse<Map<String,Object>> complexParameters(
@GET
@Path("secure/resource")
@Produces(MediaType.APPLICATION_JSON)
public ServerResponse<Map<String,Object>> responseSecureContext()
public ServerResponse<Map<String,Object>> responseSecureContext(ServerRequest request)
{
Map<String,Object> responseMap = new HashMap<>();
responseMap.put("secure",true);
Expand Down
2 changes: 1 addition & 1 deletion proteus-core/src/test/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ undertow

# x AvailableProcessors
ioThreadsMultiplier = 2
workerThreadMultiplier = 12
workerThreadsMultiplier = 12
bufferSize = 16K
directBuffers = true
}
Expand Down
2 changes: 1 addition & 1 deletion proteus-openapi/src/test/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ undertow
enableHttp2=false
# x AvailableProcessors
ioThreadsMultiplier = 2
workerThreadMultiplier = 8
workerThreadsMultiplier = 8
bufferSize = 16K
directBuffers = true
}
Expand Down

0 comments on commit ee303d9

Please sign in to comment.