24
Performance Tuning Applications with Wildfly8 Jeremy Whiting Snr Performance Software Engineer Red Hat

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

Embed Size (px)

Citation preview

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

Performance Tuning Applications with Wildfly8

Jeremy WhitingSnr Performance Software Engineer

Red Hat

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

Agenda

• Identify reasons for tuning

• Methodology for tuning (benchmarking)

• Bottlenecks • Wildfly tuning controls

• Demonstration• Bigger Picture

• Question and Answers

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

Reasons for tuning

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

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

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

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

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

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

Ideal situation

• The Funnel– Requests should queue at the top

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

Problems to consider

• Machines have finite resources

• Multi app deployment

• Shared hosting• Greedy consumers

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

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

Examples of greedy consumers...

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

greedy consumers

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

greedy consumers ….

• Hungry hippos

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

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

greedy consumers

while (true) {

System.out.println(“Chomp”);

}

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

Bottlenecks

• What are they

• Are they good ?

• Can they be helpful– When– Why

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

Bottleneck recognition

• Web tier

– Servlet

– Undertow

• EJB3 Tier

– SLSB / SFSB

– Bean methods

• JMS / JDBC Connection

– Pool stats

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

Bottleneck controls

• Thread pools– Implementation type– Sizing– Characteristics

• Bean instance counts

• Pool sizes

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

Ideal situation (again)

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

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

Queuing and Timeouts

• Acquisition timeout– Bean instances– JMS / Datasource connection

• Deadlock timeouts– Recovery Manager

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

Thread pools

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

queueless, blocking-queueless, scheduled

• Characteristics

• When to use them

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

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

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

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

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

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

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

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.

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

Bigger Picture

• Automated Metrics collection

• Derived metrics

• Feedback loop• Responsive systems

– Changing world, users, hardware failures

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

Questions / Feedback

How to contact the performance team#jbossperf at freenode

jeremyjwhiting [at] redhat.com

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

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