Java tuning on GNU/Linux for busy dev
-
Upload
tomek-borek -
Category
Software
-
view
497 -
download
1
Transcript of Java tuning on GNU/Linux for busy dev
![Page 1: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/1.jpg)
Wprowadzenie do strojenia Javy na
GNU/Linux dla zajętego programisty
Tomasz Borek, Symentis
![Page 2: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/2.jpg)
• Infected in childhood • From me parents• Amstrad, ElWro Junior• Games! Doh!• Mem pages in DOS anyone?
• In IT • ETL, crawlers, web-app, archi• IAAS, SAAS, own servers• Java 4 – 7, GNU/Linux, SQLs
• Ardent “activist”
Tomasz Borek
![Page 3: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/3.jpg)
Can be found in the net! :P
https://lafkblogs.wordpress.com/
https://twitter.com/lafk_pl
https://pl.linkedin.com/in/tjborek
GeeCON, ChamberConf, Confitura, Lambda Days, LambdaCon, Java Developer Days, JavaDay Lviv, JavaDay Kiev
![Page 4: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/4.jpg)
Tomek in IT groups
.com
http://java.pl KrakówPoznańPragaSopot
http://geecon.org
![Page 5: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/5.jpg)
Prod hits rock bottom● Everybody is kung-fu fighting● Must be quick like lightning
![Page 6: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/6.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra
![Page 7: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/7.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes
![Page 8: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/8.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes3.To know your limits (sometimes comes from point 1)
![Page 9: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/9.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes3.To know your limits (sometimes comes from point 1)4.To have access to monitoring
![Page 10: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/10.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes3.To know your limits (sometimes comes from point 1)4.To have access to monitoring5.To adjust pooling (both thread and connection)
![Page 11: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/11.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes3.To know your limits (sometimes comes from point 1)4.To have access to monitoring5.To adjust pooling (both thread and connection)6.To peruse logs and pull out anomalies
![Page 12: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/12.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes3.To know your limits (sometimes comes from point 1)4.To have access to monitoring5.To adjust pooling (both thread and connection)6.To peruse logs and pull out anomalies7.TO TUNE JVM
![Page 13: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/13.jpg)
So! Being a dev, you need:
1.To know your traffic and your app and your infra2.To know recent changes3.To know your limits (sometimes comes from point 1)4.To have access to monitoring5.To adjust pooling (both thread and connection)6.To peruse logs and pull out anomalies7.TO TUNE JVM
![Page 14: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/14.jpg)
JVM? Meaning?
• Sun Hotspot• IBM• JRockit• IceTea• OpenJDK• TCK decides
![Page 15: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/15.jpg)
JVM? Meaning?
• Sun Hotspot• IBM• JRockit• IceTea• OpenJDK• TCK decides
![Page 16: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/16.jpg)
JVM? Meaning?
• Sun Hotspot – but which version?• IBM• JRockit• IceTea• OpenJDK• TCK decides
![Page 17: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/17.jpg)
JVM? Meaning?
• Sun Hotspot – but which version? And architecture?• IBM• JRockit• IceTea• OpenJDK• TCK decides
![Page 18: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/18.jpg)
So! JVM tuning?
1.To adjust GC, based on it's logs
![Page 19: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/19.jpg)
So! JVM tuning?
1.To adjust GC, based on it's logs2.To adjust (native) heap
![Page 20: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/20.jpg)
So! JVM tuning?
1.To adjust GC, based on it's logs2.To adjust (native) heap 3.Tweaking JVM starting flags
![Page 21: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/21.jpg)
So! JVM tuning?
1.To adjust GC, based on it's logs2.To adjust (native) heap 3.Tweaking JVM starting flags4.To use TOOLS
![Page 22: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/22.jpg)
Today!● JVM tuning ● Diagnosing performance problems ● Tools● All in a rush
![Page 23: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/23.jpg)
JVM tuning
![Page 24: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/24.jpg)
Takeaway #1
JVM is a process
![Page 25: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/25.jpg)
Being a process means● OS architecture enforces JVM architecture● Your memory is limited by OS and other processes
– Heap is one
– C-heap is another!
● IO-wise and thread-wise: – Your threads and files opened are limited by ulimit
● File descriptors!
![Page 26: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/26.jpg)
OOM flavours?
![Page 27: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/27.jpg)
OOM flavours● Out of HeapSpace
![Page 28: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/28.jpg)
OOM flavours● Out of HeapSpace● PermGen error
![Page 29: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/29.jpg)
OOM flavours● Out of HeapSpace● PermGen error● Unable to create native thread
![Page 30: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/30.jpg)
OOM flavours● Out of HeapSpace● PermGen error● Unable to create native thread● There are others, these are most popular
![Page 31: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/31.jpg)
API says OutOfMemoryError is● Thrown when the Java Virtual Machine cannot
allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.
![Page 32: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/32.jpg)
API says OutOfMemoryError is● Thrown when the Java Virtual Machine cannot
allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.
![Page 33: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/33.jpg)
API says OutOfMemoryError is● Due to failure in allocating an object after garbage
collection.● Nothing about threads.● Nothing about PermGen.
![Page 34: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/34.jpg)
How much memory JVM uses?● Say you start it with Xmx == Xms == 1GB
![Page 35: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/35.jpg)
How much memory JVM uses?● Say you start it with Xmx == Xms == 1GB● 1GB?
![Page 36: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/36.jpg)
How much memory JVM uses?● Say you start it with Xmx == Xms == 1GB● 1GB?● Around 1GB?
![Page 37: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/37.jpg)
How much memory JVM uses?● Say you start it with Xmx == Xms == 1GB● 1GB?● Around 1GB?● If we talk about Java HEAP
![Page 38: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/38.jpg)
Memory management
Entire RAM
● 32 bits: can address less than 4GB.● 64 bits: can address… theoretically 16 EB.
– Still – much more!
● There's much more to 32vs64 but that's for another time
![Page 39: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/39.jpg)
Memory management
Entire RAM
What's left of RAM – C-HEAPJVM heap
-Xmx
● -Xms – minimal heap size● -Xmx – maximal heap size● When both should be set to same value?
![Page 40: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/40.jpg)
Memory management
Entire RAM
What's left of RAM – C-HEAPJVM heap
What's left – C-HEAPJVM opsJVM heap
-Xmx
PermGen
![Page 41: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/41.jpg)
PermGen● Permanent Generation
– Early Java
– for JDK classes
– and Strings
● Back then – good idea● Now removed
– JDK 7 – Strings no longer in PermGen
– JDK 8 – no PermGen at all
![Page 42: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/42.jpg)
PermGen● Permanent Generation
– Early Java
– for JDK classes
– and Strings
● Back then – good idea● Now removed
– JDK 7 – Strings no longer in PermGen
– JDK 8 – no PermGen at all
Quick fix?Increase PermGen size.
![Page 43: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/43.jpg)
Memory management
What's left – C-HEAPJVM opsJVM heap
-Xmx
PermGen
![Page 44: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/44.jpg)
GC● When it runs?
![Page 45: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/45.jpg)
GC● When it runs?● Minor collection?
![Page 46: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/46.jpg)
GC● When it runs?● Minor collection?● Major collection?
![Page 47: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/47.jpg)
GC● When it runs?● Minor collection?● Major collection?● How can a dev tune GC?
![Page 48: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/48.jpg)
Generational GC
Tenured – where long-lived are promotedEden – infants that die quickly
● Studies showed:– most objects die young
– Some live really long
● Ergo: short- and long-lived division● Minor collection: Eden● Major collection: whole heap
![Page 49: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/49.jpg)
Generational GC - mechanics● In fact Eden has also 2 Survivor spaces
– To handle locality
– Helps compress after freeing space
– First promotion to survivor, then to tenured
● Flags tell:– How many GCs object must survive to be promoted
– How large Eden / Tenured / Survivors spaces are
– What is logged (how details GC logs are)
– Many, MANY more
![Page 50: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/50.jpg)
Memory management trade-offs● Large heap – large full GC – small native and C-heap?● Smaller heap – minor GC may be enough● Make sure your objects die young and only really long
lived reach tenured
![Page 51: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/51.jpg)
JVM tuning
1.To adjust GC, based on it's logs2.To adjust (native) heap 3.Tweaking JVM starting flags4.To use TOOLS – later
![Page 52: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/52.jpg)
Takeaway #2
Log GC
![Page 53: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/53.jpg)
Takeaway #3
GC tuning is a trade-off
![Page 54: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/54.jpg)
Diagnosing performance problems
![Page 55: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/55.jpg)
„The Box”
• Heinz Kabutz, Kirk Pepperdine• Top - bottom
![Page 56: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/56.jpg)
„The Box”
• TRAFFIC: ?TRAFFIC
![Page 57: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/57.jpg)
„The Box”
• TRAFFIC: how is app used? TRAFFIC: people, automatic
![Page 58: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/58.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: ?
TRAFFIC: people, automatic
Application CODE
![Page 59: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/59.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...
TRAFFIC: people, automatic
CODE: threads, data structs, algo
![Page 60: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/60.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: ?
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM
![Page 61: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/61.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: ?
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
![Page 62: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/62.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: starting flags, GC• OS: ?
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
OS
![Page 63: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/63.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: starting flags, GC• OS: ulimit, FS, config, archi, other procs…
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
OS: FS, config, limits
![Page 64: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/64.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: starting flags, GC• OS: ulimit, FS, config, archi, other procs…• VIRT: ?
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
OS: FS, config, limits
VIRT
![Page 65: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/65.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: starting flags, GC• OS: ulimit, FS, config, archi, other procs…• VIRT: hell depends!
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
OS: FS, config, limits
VIRT
![Page 66: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/66.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: starting flags, GC• OS: ulimit, FS, config, archi, other procs…• VIRT: hell depends!• HARDWARE: ?
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
OS: FS, config, limits
VIRT
HARDWARE
![Page 67: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/67.jpg)
„The Box”
• TRAFFIC: how is app used?• CODE: threads, algos, data structures...• JVM: starting flags, GC• OS: ulimit, FS, config, archi, other procs…• VIRT: hell depends!• HARDWARE: 32 vs 64, RAM, BIOS, drivers…
TRAFFIC: people, automatic
CODE: threads, data structs, algo
JVM: flags, GC
OS: FS, config, limits
VIRT
HARDWARE
![Page 68: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/68.jpg)
Brendan Gregg – USE
• Utilization, Saturation, Errors• Use – how much in use is your resource• Saturation – how many requests await (waiting queue)• Errors – what errors are thrown by resource• http://www.brendangregg.com/usemethod.html • Create a checklist for each important resource, for
finding out Utilization, Saturation and Errors and you'll know how to soon find out what is going on with resource
![Page 69: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/69.jpg)
Takeaway #1
The Box
![Page 70: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/70.jpg)
Takeaway #2
GNU/Linux perf? Brendan Gregg
![Page 71: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/71.jpg)
TOOLS
![Page 72: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/72.jpg)
![Page 73: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/73.jpg)
![Page 74: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/74.jpg)
Takeaway #1
GNU/Linux surely has a tool for that
![Page 75: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/75.jpg)
How to find your java process?● ps … | grep java●
![Page 76: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/76.jpg)
How to find your java process?● ps … | grep java● pgrep java
![Page 77: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/77.jpg)
How to find your java process?● ps … | grep java● pgrep java● jps
![Page 78: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/78.jpg)
How to change flags on-the-fly?● jinfo
![Page 79: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/79.jpg)
How to dump threads or heap?● kill -3
![Page 80: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/80.jpg)
How to dump threads or heap?● kill -3● jstack
![Page 81: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/81.jpg)
How to dump threads or heap?● kill -3● jstack● jhat (heap)
![Page 82: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/82.jpg)
jvisualvm● Deserves it's own slide● Profiler, sampler● Monitor (heap, threads, etc.)● Calls GC, does dumps
![Page 83: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/83.jpg)
SUMMARIZING● For being rushed – prepare in advance
– Monitoring, logs, ceilings, etc.
● Log GC● JVM is a process – all process limits in your OS apply● The Box● Brendan Gregg● GNU/Linux – tools unparalleled
![Page 84: Java tuning on GNU/Linux for busy dev](https://reader034.fdocuments.net/reader034/viewer/2022051101/587b37021a28ab057d8b73f9/html5/thumbnails/84.jpg)
?