Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin McCartney turf00

View GitHub Profile
@turf00
turf00 / git.md
Created Oct 14, 2020
Git helpful
View git.md

Git helpful

Clone a repo with limited history and specific branch

git clone --depth 10 --single-branch --branch <mybranch> <therepo>

View jvm-flags.md

JVM Flags

Useful JVM flags and links

Show me current flag settings

java -XX:+PrintFlagsFinal -version
@turf00
turf00 / bash.sh
Last active Apr 16, 2020
bash-scripts
View bash.sh
#!/usr/bin/env bash
set -euo pipefail
# pipefail
# e=if a command fails the shell will exit (i.e. return > 0)
# u=write an error when trying to expand a variable that is not set
# o=set pipefail When used in combination with set -e, pipefail will make a script exit if any command in a pipeline errors.
## Fetching params by name rather than position
View Linux monitoring.md

Linux Monitoring

Memory

free -m

List of availble memory and used memory before/after buffers and caches are taken into consideration.

Does not include the memory used for the kernel caches, i.e. Slab. This memory will contribute to the overall used memory but will not show against the process.

@turf00
turf00 / jvm-native-mem.md
Last active Sep 14, 2018
JVM native memory stats
View jvm-native-mem.md

Java native memory

Stats were added in Java 8 when the permgen data was moved off heap.

Enabled by setting the option:

-XX:NativeMemoryTracking=off|summary|details

If you enable the summary or detailed information it is then possible to capture the stats using jcmd:

@turf00
turf00 / object-layout.md
Last active Nov 25, 2019
Object layout
View object-layout.md
View compressed-oops.md

Compressed Oops

Oops stands for ordinary object pointer and refers to the object references in the JVM.

On 64bit hardware a pointer is sized at 64 bits, whereas in the 32bit world obviously 32bits.

32 bit means the addressable memory is 4GB.

64 bit means the addressable memory is 2^64 bytes, which is a lot.

@turf00
turf00 / sys-mon.md
Last active May 24, 2018
System Monitoring - Processes
View sys-mon.md

pidstat

Show stats for a particular process including voluntary and non-volunatary context switches

pidstat -w -p <pid> <interval secs>

e.g. pidstat -w -p 1345 1


@turf00
turf00 / gc-enable.md
Last active Oct 19, 2017
GC Detailed Logging to file
View gc-enable.md

Enable GC detailed logging to a file, max size 5M, max number of files 10.

File will be labelled .0 to .x depending on the number of files.

-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution 
-XX:+PrintGCCause
View jvm-remote-debug.md

Enable remote debugging on port 8000

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

You can’t perform that action at this time.