Skip to content

Instantly share code, notes, and snippets.

export GODEBUG="gctrace=1"
export GOGC="off"
export GOMEMLIMIT="5000MiB"
./http-server
_alloc_MiB.....................: avg=3061.502589 min=104.566597 med=3154.655563 max=9966.452698 p(90)=4578.318161 p(95)=4781.693681
_num_GC........................: 47 min=2 max=47
_sys_MiB.......................: avg=10006.359093 min=6053.920395 med=10010.259232 max=10010.509232 p(90)=10010.509232 p(95)=10010.509232
_totalAlloc_MiB................: 102014.031433 min=6102.634956 max=102014.031433
http_reqs......................: 2006 62.543244/s
_alloc_MiB.....................: avg=3232.567927 min=103.517273 med=3459.199432 max=7017.776573 p(90)=4476.43439 p(95)=4781.083931
_num_GC........................: 43 min=4 max=43
_sys_MiB.......................: avg=7095.266705 min=7094.967514 med=7095.217514 max=7095.467514 p(90)=7095.467514 p(95)=7095.467514
_totalAlloc_MiB................: 119405.9104 min=7119.484787 max=119405.9104
_alloc_MiB.....................: avg=1420.726537 min=306.908646 med=1426.640709 max=3154.172638 p(90)=1934.265559 p(95)=2238.701762
_num_GC........................: 127 min=2 max=127
_sys_MiB.......................: avg=3660.186191 min=3243.290817 med=3555.933487 max=4492.849716 p(90)=4492.849716 p(95)=4492.849716
_totalAlloc_MiB................: 111173.459229 min=3153.929672 max=111173.459229
http_reqs......................: 2186 69.116249/s
_alloc_MiB.....................: avg=1462.192028 min=1.993828 med=1324.787132 max=9864.794876 p(90)=1934.006889 p(95)=2137.377972
_num_GC........................: 114 min=10 max=114
_sys_MiB.......................: avg=10112.061536 min=7615.991074 med=10114.640121 max=10114.640121 p(90)=10114.640121 p(95)=10114.640121
_totalAlloc_MiB................: 98560.178452 min=7627.846252 max=98560.178452
export GODEBUG="gctrace=1"
export GOGC="off"
export GOMEMLIMIT="2000MiB"
./http-server
_alloc_MiB.....................: avg=26886.056441 min=10169.836845 med=26850.120247 max=43733.548073 p(90)=43732.736609 p(95)=43733.130183
_num_GC........................: 0 min=0 max=0
_sys_MiB.......................: avg=26972.922037 min=10218.146011 med=26979.289642 max=43845.564163 p(90)=43845.564163 p(95)=43845.564163
_totalAlloc_MiB................: 43733.548073 min=10169.836845 max=43733.548073
http_reqs......................: 860 25.321205/s
_alloc_MiB.....................: avg=29083.303195 min=10169.82753 med=25427.068947 max=48106.815369 p(90)=48105.904208 p(95)=48106.331332
_num_GC........................: 0 min=0 max=0
_sys_MiB.......................: avg=29164.89418 min=10218.146011 med=25522.034409 max=48218.26442 p(90)=48218.26442 p(95)=48218.26442
_totalAlloc_MiB................: 48106.815369 min=10169.82753 max=48106.815369
export GODEBUG="gctrace=1"
export GOGC="off"
./http-server
function fetchMemMetrics() {
let response = http.get('http://localhost:8080/debug/vars');
let debugVarsResponse = JSON.parse(response.body);
return {
alloc : debugVarsResponse.memstats.Alloc / (1024 * 1024),
totalAlloc : debugVarsResponse.memstats.TotalAlloc / (1024 * 1024),
sys : debugVarsResponse.memstats.Sys / (1024 * 1024),
numGC: debugVarsResponse.memstats.NumGC
};
}
export default function() {
http.get('http://localhost:8080/hash');
// Fetch memory footprint value once per second
let memory = fetchMemMetrics();
allocMiBMetric.add(memory.alloc);
totalAllocMiBMetric.add(memory.totalAlloc);
sysMiBMetric.add(memory.sys);
numGCMetric.add(memory.numGC);
export const options = {
vus: 100,
duration: '30s',
};
import _ "expvar"