java performance: what developers must know

Download Java Performance: What developers must know

If you can't read please download the document

Upload: diego-lemos

Post on 16-Apr-2017

8.380 views

Category:

Technology


0 download

TRANSCRIPT

Java Performance

Diego Lemos

What Developers Must Know

We care about performance...

...when things go bad.

(credit: http://www.morguefile.com/)

Panic Driven Actions

Add more hardware

Work on ugly code

Long Meetings (?!)

Blame somebody

Milliseconds Matter

Amazon: Increase 100ms in load time decreased sales by 1%

Google:From loading a 10-result page in 0.4 seconds to a 30-result page loading in 0.9 seconds decreased traffic and ad revenues by 20%

Measure Dont Guess

Support decisions by measurements

Tune what matters

(credit: http://xkcd.com)

Generic Application Stack

Application

JVM

Operating System

Hardware

Profiling

Heap Analysis

Monitor System

Tools

vmstat, iostat, netstat

JMeter, Gatling

HPjmeter

VisualVM, jconsole

Demo :

Any problem here?

Java heap space

And here?

Everything is OK!

What happened here?

"catalina-exec-8190-104" - Thread t@135 java.lang.Thread.State: BLOCKEDat com.google.code.morphia.Morphia.mapPackage(Morphia.java:72)

Performance Best Practices

Test one build a day for performance issues (continuous integration)

Monitoring (production env.) for compliance

Keep users at the center of performance tuning efforts

Devs + Ops

Performance Tests on CI

Follow Coding Best Practices

KISScomplex code is hard to optimize

Loose couplingOptimize without fear of breaking anything else

Avoid contamination (external applications)

Let your objects die young

Performance myths

Tune by default (early tuning)

Optimize by precaution (over-engineer)

The architecture cannot change

Hardware will solve the problem

Conclusion

Think performance before problems come

Devs + ops working together

Monitor your application

More on this

http://java.dzone.com/kirk-dominating-consumer

https://github.com/dlresende/spring-petclinic

http://jmeter.apache.org/usermanual/glossary.html

http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

http://munchweb.com/effect-of-website-speed

http://www.javaworld.com/article/2073905/build-ci-sdlc/pick-up-performance-with-generational-garbage-collection.html