Skip to content

Instantly share code, notes, and snippets.

View nickva's full-sized avatar

Nick Vatamaniuc nickva

  • USA
View GitHub Profile
@nickva
nickva / view_cycle.py
Created February 7, 2026 17:32
Create and query couchdb views
#!/usr/bin/env python
import os
import sys
import time
import uuid
import random
import requests
import argparse
import configparser
@nickva
nickva / k6_couchdb_constant_arrival_view_query.js
Created February 7, 2026 17:31
couchdb k6 view query with constant arrival
//
// Examples:
// BENCH_RATE=500 BENCH_DURATION=20s BENCH_VIEW_LIMIT=16 k6 run ./$script.js
//
// config:set("log", "level", "warning").
//
import http from 'k6/http';
import encoding from 'k6/encoding';
@nickva
nickva / time_seq_histogram_mplib.py
Created January 10, 2026 06:57
Render CouchDB's new _time_seq response as a histogram
#!/usr/bin/env python3
# Render _time_seq response as a histogram using matplotlib
# Run as:
# http $DB/db/_time_seq | ~/scripts/time_seq_histogram_mplib.py
import json, sys
from datetime import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
@nickva
nickva / bench_parse_revid.erl
Created October 14, 2025 18:34
RevId Parsing CouchDB Benchmark: decode_hex vs binary_to_integer(RevId, 16)
-module(bench_parse_revid).
-export([go/0]).
-define(REPEAT, 100).
go() ->
go([10, 100, 500, 1000, 2500]).
@nickva
nickva / topn_view.py
Created March 26, 2025 17:11
Try out topN/bottomN built-in reducers
#!/usr/bin/env python
# ./just_view.py 500 1000
import sys
import time
import random
import requests
TIMEOUT=120
@nickva
nickva / bench_config.erl
Created February 27, 2025 23:22
Quick and dirty concurrent config get benchmark for CouchDB
% Save in ./couchdb top level
%
% $ ./dev/run ...
% $ remsh
%
% > bench_config:go(1000000, 100).
% #{max => 5.620738,min => 0.62035,total => 5633922,
% avg => 3.82163797,p50 => 4.568493,p75 => 5.314903,
% p90 => 5.519178}
%
#!/bin/bash
# ./dev/run --admin=adm:pass -n1
# "http" is httpie (https://httpie.io)
DB=http://adm:pass@127.0.0.1:15984
http -q delete $DB/db
http -q put $DB/db
@nickva
nickva / purge.sh
Created February 19, 2025 16:26
check purge infos endpoint
#!/bin/sh
# ./dev/run --admin=adm:pass -n1
# "http" is httpie (https://httpie.io)
DB=http://adm:pass@127.0.0.1:15984
http -q delete $DB/db
http -q put $DB/db
@nickva
nickva / just_view.py
Created February 16, 2025 06:09
CouchDB fill a db with docs and run a view
#!/usr/bin/env python
# ./just_view.py 500 1000
import sys
import time
import requests
TIMEOUT=120
AUTH=('adm','pass')
@nickva
nickva / replicate_att.sh
Created February 7, 2025 02:47
CouchDB replicate attachment twice
#!/bin/sh
# Create test DBs
echo "***** SETTING UP DBS *****"
curl -s -XDELETE 'http://adm:pass@localhost:15984/source'
curl -s -XDELETE 'http://adm:pass@localhost:15984/target'
curl -s -XPUT 'http://adm:pass@localhost:15984/source'
echo '{