Everything I Ever Learned About JVM Performance Tuning -Twitter – Presentation Transcript

Published: 204 days ago

Category: Science

Tags: , , , , , , , ,

Description:

Attila Szegedi, Software Engineer@asz 1
Everything I everlearned about JVMperformance tuning @twitter 2
Everything Morethan I ever wanted to learned aboutJVM performance tuning @twitter 3
• Memory tuning• CPU usage tuning• Lock contention tuning• I/O tuning 4
Twitter’s biggest enemy 5
Twitter’s biggest enemy Latency 5
Twitter’s biggest enemy Latency 5
Twitter’s biggest enemy LatencyCC licensed image from http://www.flickr.com/photos/dunechaser/213255210/ 5
Latency contributors• By far the biggest contributor is garbage collector• others are, in no particular order: • in-process locking and thread scheduling, • I/O, • application algorithmic inefficiencies. 6
Areas of performance tuning• Memory tuning• Lock contention tuning• CPU usage tuning• I/O tuning 7
Areas of memory performance tuning• Memory footprint tuning• Allocation rate tuning• Garbage collection tuning 8
Memory footprint tuning• So you got an OutOfMemoryError… • Maybe you just have too much data! • Maybe your data representation is fat! • You can also have a genuine memory leak… 9
Too much data• Run with -verbosegc• Observe numbers in “Full GC” messages secs] [Full GC $before->$after($total), $time• Can you give the JVM more memory?• Do you need all that data in memory? Consider using: • a LRU cache, or… • soft references* 10
Fat data• Can be a problem when you want to do wacky things, like • load the full Twitter social graph in a single JVM • load all user metadata in a single JVM• Slimming internal data representation works at these economies of scale 11
Fat data: object header • JVM object header is normally two machine words. • That’s 16 bytes, or 128 bits on a 64-bit JVM! • new java.lang.Object() takes 16 bytes. • new byte[0] takes 24 bytes. 12

Enhanced by Zemanta
Be Sociable, Share!
    'No new videos.'

Leave a Reply

You must be logged in to post a comment.