Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The shell script `regionsize_vs_objectsize.sh` will take a gc.log
as input and return the percent of Humongous Objects that would fit
into various G1RegionSize's (2mb-32mb by powers of 2).

If JVM Unified Logging Framework is enabled, this will not work out of the box, we will need to enable printing of information about adaptive generation size.
See [gc log preparation](https://github.com/HubSpot/gc_log_visualizer#gc-log-preparation) for adding GC logs to make this work.

```
./regionsize_vs_objectsize.sh <gc.log>
1986 humongous objects referenced in <gc.log>
Expand Down Expand Up @@ -51,6 +54,8 @@ The following gc params are required for full functionality.
```
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy
```
_For JVM Unified Logging Framework, corresponding options can be found [here](https://docs.oracle.com/javase/9/tools/java.htm#JSWOR-GUID-9569449C-525F-4474-972C-4C1F63D5C357).
For example, for legacy GC flag `-XX:PrintAdaptiveSizePolicy` (used to add log lines to calculate humongous objects with `regionsize_vs_objectsize.sh`) instead use `-Xlog:ergo*=debug`._
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-XX:PrintAdaptiveSizePolicy is missing a +: -XX:+PrintAdaptiveSizePolicy


## required python libs
The python libs that are required can be found in the setup.py
Expand Down
10 changes: 5 additions & 5 deletions regionsize_vs_objectsize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ if [ -z "${log}" ] ; then
fi

total=`grep "source: concurrent humongous allocation" ${log} | wc -l`
fit2mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\) bytes.*/\1/' | awk '{if($1<1048576) print}' | wc -l`
fit4mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\) bytes.*/\1/' | awk '{if($1<2097152) print}' | wc -l`
fit8mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\) bytes.*/\1/' | awk '{if($1<4194304) print}' | wc -l`
fit16mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\) bytes.*/\1/' | awk '{if($1<8388608) print}' | wc -l`
fit32mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\) bytes.*/\1/' | awk '{if($1<16777216) print}' | wc -l`
fit2mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\).*/\1/' | awk '{if($1<1048576) print}' | wc -l`
fit4mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\).*/\1/' | awk '{if($1<2097152) print}' | wc -l`
fit8mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\).*/\1/' | awk '{if($1<4194304) print}' | wc -l`
fit16mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\).*/\1/' | awk '{if($1<8388608) print}' | wc -l`
fit32mb=`grep "source: concurrent humongous allocation" ${log} | sed 's/.*allocation request: \([0-9]*\).*/\1/' | awk '{if($1<16777216) print}' | wc -l`
Comment on lines +10 to +14
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is slight difference between log lines of legacy GC options and jvm unified logging event

Legacy

 0.106: [G1Ergonomics (Concurrent Cycles) request concurrent cycle initiation, reason: occupancy higher than threshold, occupancy: 60817408 bytes, allocation request: 1048592 bytes, threshold: 60397965 bytes (45.00 %), source: concurrent humongous allocation]

Unified Framework

[334133.389s][debug][gc,ergo,ihop  ] Request concurrent cycle initiation (occupancy higher than threshold) occupancy: 390070272B allocation request: 524304B threshold: 350322636B (32.63) source: concurrent humongous allocation


echo "${total} humongous objects referenced in ${log}"
echo `echo ${fit2mb} ${total} | awk '{printf "%2.0f", 100 * $1 / $2}'`% would not be humongous with a 2mb g1 region size
Expand Down