Skip to content

Instantly share code, notes, and snippets.

Sam Van Oort svanoort

  • CloudBees Inc
  • Raleigh, NC
Block or report user

Report or block svanoort

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
svanoort / idea.vmoptions
Created Nov 3, 2016
JVM args for a fast Intellij
View idea.vmoptions
# custom IntelliJ IDEA VM options
svanoort /
Last active Jan 7, 2020
Blessed GC settings for big servers
# Base settings and GC logging
-server -XX:+AlwaysPreTouch # First should be default, but we make it explicit, second pre-zeroes memory mapped pages on JVM startup -- improves runtime performance
# -Xloggc:gc-%t.log # CUSTOMIZE LOCATION HERE - $path/gc-%t.log -- the %t in the gc log file path is so we get a new file with each JVM restart
-XX:NumberOfGCLogFiles=5 -XX:+UseGCLogFileRotation -XX:GCLogFileSize=20m # Limits the number of files, logs to folder
-XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintGCCause
-XX:+PrintTenuringDistribution -XX:+PrintReferenceGC -XX:+PrintAdaptiveSizePolicy # gather info on object age & reference GC time for further tuning if needed.
# G1 specific settings -- probably should be default for multi-core systems with >2 GB of heap (below that, default is probably fine)
svanoort /
Last active Oct 20, 2016
Analyze success pstools dumps to find threads eating a lot of system time
import sys
import re
# You'll need to extract JUST the table of pstools output (no headers!) from your pstools thread dumps for windows
if not sys.argv[1] or not sys.argv[2]:
print("Need to supply the path to the pstools before and after filenames")
svanoort / test-pipelines.groovy
Last active Sep 30, 2016
Test mini-pipelines for common problem cases in UI
View test-pipelines.groovy
// Test for handling of errors in nested blocks, and UI rendering of same
stage 'sample'
node {
dir('sample') {
dir('more') {
sh 'failme'
svanoort /
Last active Oct 1, 2016
Do a bash speedtest and reboot router if under 5 MBit
# Curl the bandwidth test site for 10 MB file and get speed in bytes/second, reboot cable modem if <5 MBit
# Useful as bash alias that retests and triggers every hour:
# alias continuously_speedtest='while [ true ]; do echo "Sleeping 1 hour and then speedtesting network"; sleep 3600; bash ~/; done'
set -o pipefail
echo 'Speedtesting modem now'
DOWN_SPEED=$(curl -t 100 -o /dev/null -s -w "%{speed_download}" | sed -E "s/\.[0-9]+//g")
if [ "$?" -ne 0 ]; then
echo "Speed test failed!"
svanoort / gist:532a6918389b3a0e9dd4
Created Mar 18, 2016
Tuning Java for minimal memory footprint
View gist:532a6918389b3a0e9dd4
One source:
# Set the XMX to cap your max heap, set the xms to a reasonable minimum
-Xmx384m -Xms100m
# No more than 40% of heap free, lowest GC overhead and keeps heap small - still under 0.5% GC time
-XX:+UseSerialGC -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40
# parallel version, allows up to 4% time spent on GC, generally uses heap more efficiently, but at cost of 2x the CPU USE
svanoort /
Last active Jul 28, 2019
Java Microbenchmarks
package hudson.cli;
import org.junit.Test;
import java.util.*;
// Micro benchmark different array ops in Java
// Originally started from
// Now completely rewritten to correctly warm up the JIT compilation and take an average over many runs
// Tweaked/corrected version from
You can’t perform that action at this time.