Giter VIP home page Giter VIP logo

heapfragger's Introduction

HeapFragger

HeapFragger: A heap fragmentation inducer, meant to induce compaction of the heap on a regular basis using a limited (and settable) amount of CPU and memory resources.

The purpose of HeapFragger is [among other things] to aid application testers in inducing inevitable-but-rare garbage collection events, such that they would occur on a regular and more frequent and reliable basis. Doing so allows the characterization of system behavior, such as response time envelope, within practical test cycle times.

HeapFragger works on the simple basis of repeatedly generating large sets of objects of a given size, pruning each set down to a much smaller remaining live set after it has been promoted, and increasing the object size between passes such that is becomes unlikely to fit in the areas freed up by objects released in a previous pass without some amount of compaction. HeapFragger ages object sets before pruning them down in order to bypass potential artificial early compaction by young generation collectors.

By the time enough passes are done such that aggregate space allocated by the passes roughly matches the heap size (although a much smaller percentage is actually alive), some level of compaction likely or inevitable.

HeapFragger's resource consumption is completely tunable, it will throttle itself to a tunable rate of allocation, and limit it's heap footprint to configurable level. When run with default settings, HeapFragger will occupy 10% of total heap space, and allocate objects at a rate of 50MB/sec.

Altering the allocation rate and the peakMBPerIncrement parameter (a larger peakMBPerIncrement will require fewer churning passes in each compaction-inducing iteration), will change the frequency with which compactions occur.The main (common) settable items are:

  • allocMBsPerSec [-a, default: 50]: Allocation rate - controls the CPU % HeapFragger occupies, and affects compaction event freq.

  • heapBudgetAsFraction [-f, default: 0.1] or heapBudgetInMB [-b, default: derived from heapBudgetAsFraction] can be used to controls the peak amount of heap space that the HeapFragger will use for it's temporary churning storage needs. While the default setting is to use ~10% of the detected heap size, higher heap budgets can be used to allow HeapFragger to fragment the heap more quickly.

  • heapMBtoSitOn [-s, default: 0]: Useful for experimenting with the effects of varying heap occupancies on compaction times. Causes HeapFragger to pre-allocate an additional static live set of the given size.

  • pauseThresholdMs [-t, default: 350]: For convenience, HeapFragger includes a simple pause detector that will report on detected pauses to stderr. The pauseThresholdMs parameter controls the threshold below which detected pauses will not be reported.

HeapFragger will typically be added to existing Java applications as a javaagent. E.g. a typical command line will be:

java ... -javaagent:HeapFragger.jar="-a 100" MyApp myAppArgs

The HeapFragger jar also includes a convenient Idle class that can be used for demo purposes. E.g. the following command line will demonstrate periodic promotion-failure related pauses with the HotSpot CMS collector, with each resulting Full GC having to deal with at least 512MB of live matter in the heap:

java -Xmx2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDetails -Xloggc:gc.log -javaagent:HeapFragger.jar="-a 400 -s 512" org.heaputils.Idle -t 1000000000

You can also combine HeapFragger with jHiccup to produce a histogram log that can then be convenitely plotted with HistogramLogAnalyzer

E.g. here is an example command line for driving the G1GC bonkers and logging the resultant hiccup behavior:
java -Xmx4g -Xmx4g -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDetails -Xloggc:g1gc.log -javaagent:HeapFragger.jar="-a 1000 -s 1024 -v" -javaagent:jHiccup.jar="-d 0 -i 1000 -l g1gc.hlog" org.heaputils.Idle -t 1000000000

heapfragger's People

Contributors

giltene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

heapfragger's Issues

Unable to run heapfragger in background

I need to execute a long-running (several hours) HeapFragger session on a remote machine which requires me to run it in the background using nohup to avoid aborted session due to connection timeout. When I try to run HeapFragger with nohup or in the background, eg

openj9/jdk-11.0.1+13/bin/java -Xmx2g -Xms2g -verbose:gc -Xverbosegclog:d.vlog \
-javaagent:HeapFragger.jar="-a 512 -s 0" \
-javaagent:jHiccup.jar="-d 0 -i 1000 -l d.hlog" \
org.HeapFragger.Idle -t 100000 &>>d.err&

it returns immediately without output to stdout/stderr. The hiccup log is also empty and the verbose gc log shows only its initialization header, no collections are recorded. If I remove the trailing ampersand and run it in the foreground it runs as expected. Same behavior with OpenJDK as for OpenJ9.

I am attempting to run this on an x86-64 server running Red Hat Enterprise Linux 7.5 with 16 cores and ~18G RAM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.