Skip to content

Instantly share code, notes, and snippets.

View pgbench-fsync.md

Configuration from https://github.com/robuye/pgbench-docker with the following parameters:

DOCKER_IMAGE=postgres:11
PGBENCH_SCALE=10    # scale factor (keep it higher or equal to concurrent clients)
PGBENCH_CLIENTS=10   # clients or concurrent db sessions
PGBENCH_RATE=1000000 # 1M rate limit, number of transactions per second
PGBENCH_THREADS=8   # number of threads to run to manage connections
View curb-multi-connections.rb
require 'curb'
require 'socket'
URL = 'https://google.com'
# 0123456 default & reserved RubyVM. It will probably include 7 from Dir.glob
FDS_OPEN_BEFORE_START = Dir.glob("/proc/self/fd/*").map do |fd_path|
File.basename(fd_path).to_i
end
View specification_pattern_basics.rb
module Spec
module Generic
class And
def initialize(specs)
@specifications = specs
end
def is_satisfied_by?(subject)
@specifications.all? do |spec|
spec.is_satisfied_by?(subject)