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
svanoort / idea.vmoptions
Created Nov 3, 2016
JVM args for a fast Intellij
View idea.vmoptions
# custom IntelliJ IDEA VM options
-server
-Xss16m
-Xms256m
-Xmx1500m
-XX:ReservedCodeCacheSize=240m
-XX:+AlwaysPreTouch
-XX:+TieredCompilation
-XX:+UseCompressedOops
-XX:+UseCompressedClassesPointers
@svanoort
svanoort / gcsettings.sh
Last active Jan 7, 2020
Blessed GC settings for big servers
View gcsettings.sh
# 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)
-XX:+UseG1GC
-XX:+UseStringDeduplication
@svanoort
svanoort / analyze-pstools.py
Last active Oct 20, 2016
Analyze success pstools dumps to find threads eating a lot of system time
View analyze-pstools.py
#!/bin/python
import sys
import re
# You'll need to extract JUST the table of pstools output (no headers!) from your pstools thread dumps for windows
print(sys.argv)
if not sys.argv[1] or not sys.argv[2]:
print("Need to supply the path to the pstools before and after filenames")
exit()
@svanoort
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
svanoort / speedtest-restart.sh
Last active Oct 1, 2016
Do a bash speedtest and reboot router if under 5 MBit
View speedtest-restart.sh
#!/bin/bash
# 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 ~/speedtest-restart.sh; done'
set -o pipefail
echo 'Speedtesting modem now'
DOWN_SPEED=$(curl http://speedtest.wdc01.softlayer.com/downloads/test10.zip -t 100 -o /dev/null -s -w "%{speed_download}" | sed -E "s/\.[0-9]+//g")
if [ "$?" -ne 0 ]; then
echo "Speed test failed!"
@svanoort
svanoort / gist:532a6918389b3a0e9dd4
Created Mar 18, 2016
Tuning Java for minimal memory footprint
View gist:532a6918389b3a0e9dd4
One source: http://developers.redhat.com/blog/2014/07/22/dude-wheres-my-paas-memory-tuning-javas-footprint-in-openshift-part-2/
# 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
seropt:
-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
svanoort / CollectionTest.java
Last active Jul 28, 2019
Java Microbenchmarks
View CollectionTest.java
package hudson.cli;
import org.junit.Test;
import java.util.*;
// Micro benchmark different array ops in Java
// Originally started from http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist/7507740#7507740
// Now completely rewritten to correctly warm up the JIT compilation and take an average over many runs
// Tweaked/corrected version from http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist/7507740#7507740
You can’t perform that action at this time.