London JBUG April 2015 - Performance Tuning Apps with WildFly Application Server

Preview:

Citation preview

Performance Tuning Applications with Wildfly8

Jeremy WhitingSnr Performance Software Engineer

Red Hat

Agenda

• Identify reasons for tuning

• Methodology for tuning (benchmarking)

• Bottlenecks • Wildfly tuning controls

• Demonstration• Bigger Picture

• Question and Answers

Reasons for tuning

• Contractual Obligations• User experience• Shared systems• Ops per second• Predictable system degradation• Career aspirations / credibility

Performance Benchmarking

• Methodology, Java Performance (book)

• Write “test objectives” (½ page)

• Harness test tools– Gatling– Faban– Smart Frog

• Test one change at a time

• Observe system during tests

Crafting a performance test

• Use your “Test Objective” document

• Write your driver

• Set-up software / hardware• Run tests

• Check for silly mistakes– Verify using simple tools– Driver checking for errors– Recovery Manager activity

Ideal situation

• The Funnel– Requests should queue at the top

Problems to consider

• Machines have finite resources

• Multi app deployment

• Shared hosting• Greedy consumers

Let's take a look at some greedy consumers....

Examples of greedy consumers...

greedy consumers

greedy consumers ….

• Hungry hippos

Image: "Hippo Indigestion" by David Goehring from New York, NY, USA - Hippo Indigestion.

greedy consumers

while (true) {

System.out.println(“Chomp”);

}

Bottlenecks

• What are they

• Are they good ?

• Can they be helpful– When– Why

Bottleneck recognition

• Web tier

– Servlet

– Undertow

• EJB3 Tier

– SLSB / SFSB

– Bean methods

• JMS / JDBC Connection

– Pool stats

Bottleneck controls

• Thread pools– Implementation type– Sizing– Characteristics

• Bean instance counts

• Pool sizes

Ideal situation (again)

• The Funnel– Requests queue up at the top of the funnel

Queuing and Timeouts

• Acquisition timeout– Bean instances– JMS / Datasource connection

• Deadlock timeouts– Recovery Manager

Thread pools

• Types available in Wildfly– Unbounded, bounded, blocking-bounded,

queueless, blocking-queueless, scheduled

• Characteristics

• When to use them

unbounded

● Characteristics– Unknown latency– Can support unlimited requests– Can adapt to varying load– Can cause OOM

• When to use– Latency is a low requirement– High throughput

bounded

• Characteristics– OOM can be prevented– Adaptable to demand and efficient– Better latency guarantees– Some requests may fail

• When to use– Latency is a priority

Blocking-bounded

• Characteristics– Reliable latency if not overloaded– Can cope with load surges (predictable)– Can be configured to prevent OOM

• When to use– Latency is medium priority– Load surges can be farmed out over time

Perf test demoBottleneck tuning

• Objective: Identify any bottlenecks

• Use a driver to create load (Faban)

• Sample application

• Run Perf test <---

• Take statistic samples |

• Draw conclusions |

• Change configuration ---

• Stop, reached objective or time box.

Bigger Picture

• Automated Metrics collection

• Derived metrics

• Feedback loop• Responsive systems

– Changing world, users, hardware failures

Questions / Feedback

How to contact the performance team#jbossperf at freenode

jeremyjwhiting [at] redhat.com

References

• Java Performance by Charlie Hunt and Binu John, ISBN: 0137142528

• Byteman, http://byteman.jboss.org/

• dstat tool, http://dag.wiee.rs/home-made/dstat/

• Gatling, gatling.io

• Faban, www.faban.org