Skip to content

Instantly share code, notes, and snippets.

View nickva's full-sized avatar

Nick Vatamaniuc nickva

  • USA
View GitHub Profile
@nickva
nickva / couch_job_bench.erl
Created June 24, 2019 13:30
Benchmark for couch_jobs branch
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
% License for the specific language governing permissions and limitations under
@nickva
nickva / add_docs.py
Created November 13, 2019 23:29
Add and read docs from CouchDB
#!/usr/bin/env python
import sys, socket, hashlib, base64, itertools, time, random, string, couchdb
DEBUG = True
PORT = 15984
DATABASE = 'db'
def lg(*args):
if DEBUG:
@nickva
nickva / viewsize_fdb.py
Created March 5, 2020 20:17
View size testing script adapted for CouchDB 4.0
#!/usr/bin/env python
import argparse
import sys
import couchdb
import random
import string
import uuid
import time
import copy
#!/usr/bin/env python
# Run with an n=1 dev/run test cluster
# Needs python 3.7 minimum
#
# $ virtualenv -p python3 venv3
# $ . venv3/bin/activate
# $ pip install requests
import base64
@nickva
nickva / validate_erlang_install.md
Last active November 8, 2021 22:34
Validate Erlang Install By Running Custom Tests Suites
@nickva
nickva / monitor_nodes.erl
Created November 11, 2021 20:05
Erlang net_kernel:monitor_nodes/1 snippet
spawn(fun () ->
net_kernel:monitor_nodes(true),
F = fun Loop() ->
receive Msg ->
io:format("~n *** mon msg:~p~n", [Msg]),
Loop()
end
end,
F()
end).
@nickva
nickva / read_only_replication_source.sh
Last active February 10, 2022 19:45
Prevent regular doc writes to the replication source
#!/bin/sh
# Prevent regular doc writes to the replication source. Used, for example, when
# migrating to a new instance and we want to prevent clients writing to the old
# instance by accident. Design doc writes and all doc reads can still take
# place.
#
# (`http` is the httpie client https://httpie.io/)
DB="http://adm:pass@localhost:15984"
@nickva
nickva / repscript.sh
Created February 27, 2022 20:43
Simple CouchDB replication setup
#!/bin/bash
set -xe
DB=http://adm:pass@localhost:15984
http $DB
http -b delete $DB/_replicator
http -b delete $DB/source
http -b delete $DB/target
@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
-module(slow_tuples).
-export([
run/0
]).
run() ->
run(7500, 0.0008, {1647,841737,351137}).