View incremental_alloc.py
import sys
base_alloc = bytearray(int(sys.argv[1])*1024*1024*1024)
extensions = []
while True:
print("Append 128MB")
sys.stdin.readline()
extensions.append(bytearray(128*1024*1024))
View gist:218f8f3bab74fa623677b450f372286e
kthr memory page disk faults cpu
r b w swap free si so pi po fr de sr bk bk lf rm in sy cs us sy id
0 0 0 77583364 10655732 0 0 161 0 0 0 2107 -0 19 37 -11 2988 5306 1861 0 1 98
0 0 0 68523744 1342084 0 0 0 0 0 0 0 0 0 0 0 2670 691 457 0 1 99
0 0 0 68523664 1342004 0 0 0 0 0 0 0 0 8 0 0 2720 660 1230 0 1 99
0 0 0 68523664 1342004 0 0 0 0 0 0 0 0 0 0 0 2633 2000 541 0 1 99
0 0 0 68523664 1342004 0 0 0 0 0 0 0 0 0 0 0 2584 646 410 0 1 99
0 0 0 68523664 1342004 0 0 0 0 0 0 0 0 0 0 0 2504 652 361 0 1 99
0 0 0 68523664 1342004 0 0 0 0 0 0 0 0 0 0 0 2544 646 406 0 1 99
0 0 0 68523664 1342004 0 0 0 0 0 0 0 0 0 0 0 2608 1311 498 0 1 99
View root-in-opt
#!/bin/sh
mkdir -p /opt/root
mkdir -p /opt/root/.ssh
cd /
cp /root/.* /opt/root
cp /root/.ssh/* /opt/root/.ssh
rm -rf /root
ln -s /opt/root
touch /opt/root/.forward
echo 'real@email' > /opt/root/.forward
View varnish.xml
<?xml version='1.0'?>
<!--
Copy to /opt/custom/smf
Assumes Varnish was built on SmartOS with configure --prefix=/opt/local --mandir=/opt/local/man
By default it looks for a backend at localhost:8000 ... create one quickly with 'python3 -m http.server'
-->
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='varnish'>
<service name='network/varnish' type='service' version='1'>
<create_default_instance enabled='true' />
View cache.cpp
// c++ -O3 -std=c++11 cache.cpp
#include <time.h>
#include <random>
#include <stdio.h>
using namespace std;
const int n_cachelines=65536;
const int bytes_cacheline=64;
View small-arc.sh
#!/bin/bash
echo "arc_stats::print -a arcstat_p.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
echo "arc_stats::print -a arcstat_c.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
echo "arc_stats::print -a arcstat_c_max.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw