Skip to content

Instantly share code, notes, and snippets.

View nickva's full-sized avatar

Nick Vatamaniuc nickva

  • USA
View GitHub Profile
@nickva
nickva / viewsize.py
Last active December 7, 2022 18:37
CouchDB View Benchmark
#!/usr/bin/env python
# still python2, sorry, old script
# pip install CouchDB
# ./viewsize.py
# file active external dtavg
# 18080120 17607050 14984706 45.973
import argparse
import sys
@nickva
nickva / dbcreate.py
Created November 28, 2022 18:08
Apache CouchDB DB Stampede
#!/usr/bin/env python
# Uses CouchDB (pip install CouchDB)
import sys, couchdb, time, os, uuid, argparse, random, traceback
from multiprocessing.dummy import Pool as ThreadPool
DB_URLS = [
'http://adm:pass@localhost:15984',
'http://adm:pass@localhost:25984',
@nickva
nickva / large_doc_compact_multiple_updates.sh
Created November 13, 2022 04:00
CouchDB doc update and delete script
#!/bin/bash
set -e
URL=http://adm:pass@localhost:15984
DB=${URL}/dbx
CFG=${URL}/_node/_local/_config
TMPFILE=/tmp/couch_largehex
DOCSIZE=100
@nickva
nickva / large_doc_compact.sh
Created November 11, 2022 20:04
couchdb smoosh doesn't trigger compaction
#!/bin/bash
set -e
URL=http://adm:pass@localhost:15984
DB=${URL}/dbx
CFG=${URL}/_node/_local/_config
DOC=doc1
TMPFILE=/tmp/couch_largehex
@nickva
nickva / purgesh.sh
Created June 22, 2022 05:16
Add some views and docs then purge files
#!/bin/sh
http delete $DB/db
http put $DB/db'?q=4'
http put $DB/db/_design/d views:='{"v": {"map":"function(doc){emit(doc._id, 42);}"}}'
http put $DB/db/x a=b
http put $DB/db/y a=b
http put $DB/db/z a=b
@nickva
nickva / sorting.sh
Created June 10, 2022 19:56
Sorting an already sorted list in Erlang
% ./erlperf \
'runner(Unsorted) -> lists:sort(Unsorted).' \
--init_runner '[{rand:uniform(), I} || I <- lists:seq(1,500)].' \
'runner(Sorted) -> lists:sort(Sorted).' \
--init_runner 'lists:sort([{rand:uniform(), I} || I <- lists:seq(1,500)]).'
Code || QPS Time Rel
runner(Sorted) -> lists:sort(Sorted). 1 69223 14446 ns 100%
runner(Unsorted) -> lists:sort(Unsorted). 1 7158 140 us 10%
@nickva
nickva / perfparams.py
Last active June 26, 2024 10:27
perfparams - convert a simple .conf file to couchdb .ini and vm.args files
#!/usr/bin/env python3
import optparse
from dataclasses import dataclass
from collections import defaultdict
@dataclass
class Param:
name: str
@nickva
nickva / dist_perf.erl
Last active April 13, 2022 20:59
Erlang Distribution Protocol Benchmark
%
% $ erl -name [email protected]
%
% $ erl -name [email protected]
% ([email protected])2> dist_perf:go('[email protected]').
% started
% Sent:953MB/s, Hist:{6,0,0,12,0,0,0,0,0,0,0} RHist:{0,0,0,0,0,0,0,0,0,97,0}
% Sent:961MB/s, Hist:{1,0,0,12,0,0,0,0,0,0,0} RHist:{0,0,0,0,0,0,0,0,0,155,0}
% Sent:953MB/s, Hist:{6,0,0,12,0,0,0,0,0,0,0} RHist:{0,0,0,0,0,0,0,0,0,202,0}
%
-module(slow_tuples).
-export([
run/0
]).
run() ->
run(7500, 0.0008, {1647,841737,351137}).
@nickva
nickva / stampede_dbs_ddocs_vdpus.py
Created March 18, 2022 14:43
Stampede a bunch of ddoc and VDU calls on a CouchDB cluster
#!/usr/bin/env python
#
# Use a 3 node cluster
#
# Args examples:
# ./script.py -x 20 -n 100 -w 5 -p 10 -q
# ./script.py -x 100 -n 2 -p 20 -w 1 -t 10
# ./script.py -x 101 -n 2 -p 10 -w 5 -t 2