Jetty Logo
Version: 9.4.7.v20170914
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

Chapter 20. Optimizing Jetty

Table of Contents

Garbage Collection
High Load
Limiting Load

There are many ways to optimize Jetty which vary depending on the situation. Are you trying to optimize for number of requests within a given amount of time? Are you trying to optimize the serving of static content? Do you have a large bit of hardware that you want to give entirely over to Jetty to use to its heart’s delight? This chapter examines a few of the many different ways to optimize Jetty.

Garbage Collection

Tuning the JVM garbage collection (GC) can greatly improve Jetty performance. Specifically, you can avoid pauses while the system performs full garbage collections. Optimal tuning of the GC depends on the behavior of the application and requires detailed analysis, however there are general recommendations.

See official Java 8 Garbage Collection documentation for further assistance.

Tuning Examples

These options are general to the Oracle JVM, and work in a Java 8 installation. They provide good information about how your JVM is running; based on that initial information, you can then tune more finely.

The most important thing you can do for yourself when considering GC is to capture the GC activity so that you can analyze what is happening and how often it happens.


There are not many recommended options for GC that can apply to nearly all users.

However, the most obvious one is to disable explicit GC (this is performed regularly by RMI and can introduce an abnormal amount of GC pauses).


Before you apply any other GC tuning options, monitor your GC logs to see if tuning the CMS makes sense for your environment.

A common setup for those just starting out with GC tuning is included below for reference.


This example configuration below could have a negative effect on your application performance, so continued monitoring of your GC log before and after is highly recommended to know if the configuration was beneficial or not.


See an error or something missing? Contribute to this documentation at Github!(Generated: 2017-09-14)