WebSphere Tutorial · Running WebSphere in Production · Lesson 20 of 23

Performance Tuning

Tuning WebSphere for throughput and latency: JVM heap and GC, thread pools, connection pools and the monitoring that tells you what to change.

Members can save this page, take notes and track progress. See membership · Sign in

Measure first

Use PMI (traditional WAS) or MicroProfile Metrics (Liberty) and verbose GC logs under realistic load. Change one setting at a time and compare.

The main knobs

  • JVM heap: size so heap use after a full GC is roughly 40-70% of the maximum; the default OpenJ9 policy gencon suits most applications. Too small means frequent GC and OutOfMemoryError; too big means long pauses.
  • Thread pools: traditional WAS's WebContainer pool (50 threads by default) caps concurrent requests; Liberty uses one self-tuning executor. More threads help only if they're waiting on I/O, not if the CPU is busy.
  • Connection pools: sized against the database; watch wait time.
  • Timeouts everywhere: they keep slow dependencies from consuming every thread.
  • Caching: dynamic cache (traditional WAS), application caches, HTTP caching.
How many threads help: it depends on how long requests waitTry it yourself
cores = 8
for wait_fraction in [0.0, 0.5, 0.9]:          # share of request time spent waiting on I/O
    useful_threads = round(cores / (1 - wait_fraction)) if wait_fraction < 1 else None
    print(f"requests wait {wait_fraction:.0%} of the time -> about {useful_threads} threads keep {cores} cores busy")

Output

requests wait 0% of the time -> about 8 threads keep 8 cores busy
requests wait 50% of the time -> about 16 threads keep 8 cores busy
requests wait 90% of the time -> about 80 threads keep 8 cores busy

Test yourself

Adding threads helps most when…

  1. the CPU is at 100%
  2. requests spend much of their time waiting on I/O
  3. the heap is full
  4. there's one user
Show answer

Answer: requests spend much of their time waiting on I/O

Waiting threads leave CPU idle; more threads use it.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake