This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a user land file for testing. | |
# dd if=/dev/urandom of=/tmp/urandom bs=1M count=10 | |
# | |
# urandom-reads.py infile threads | |
# Examples: | |
# time python2.6 urandom-reads.py /tmp/urandom | |
# time python2.6 urandom-reads.py /dev/urandom | |
# | |
# R to generate a plot of the read time distribution at each level of concurrency | |
# rdt = read.csv("output.csv", header=F) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boltzmann <- function(x, t=0.1) { exp(x/t) / sum(exp(x/t)) } | |
x=rnorm(10,mean=1,sd=0.5) | |
plot(boltzmann(x)) | |
lines(boltzmann(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#CREATE TABLE poky ( | |
#bucket varchar(256) NOT NULL, | |
#key varchar(1024) NOT NULL, | |
#data text, | |
#created_at timestamptz NOT NULL DEFAULT NOW() CONSTRAINT created_at_utc_check CHECK (EXTRACT(TIMEZONE FROM created_at) = '0'), | |
#modified_at timestamptz NOT NULL DEFAULT NOW() CONSTRAINT modified_at_utc_ch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'minesh' | |
from optparse import OptionParser | |
from qds_sdk.commands import * | |
from io import * | |
class ResultsFP: | |
def __init__(self, filename): | |
self.filename = filename | |
def write(self, res): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_links": { | |
"self": { | |
"href": "/147/threads?viewableOnly=true&limit=25&page=0&sortKey=trending&sortDirection=descending&responseGroup=small" | |
}, | |
"first": [ | |
{ | |
"href": "/147/threads?viewableOnly=true&limit=25&page=0&sortKey=trending&sortDirection=descending&responseGroup=small" | |
} | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in {1..20}; do ( time -p curl -I -s http://www.site.com ) 2>&1 | grep real | cut -c6-; done | sort -n | awk '{ d[NR]=$1; } END { print NR, "-", d[1], d[int(NR*0.5)], d[int(NR*0.95)], d[NR]; }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test=# explain (analyze, buffers, verbose) update counters set count = count + 1 where count_type = 0 and count_id = 1; | |
QUERY PLAN | |
---------------------------------------------------------------------------------------------------------------- | |
Update on public.counters (cost=0.00..5.03 rows=1 width=18) (actual time=0.036..0.036 rows=0 loops=1) | |
Buffers: shared hit=6 | |
-> Seq Scan on public.counters (cost=0.00..5.03 rows=1 width=18) (actual time=0.020..0.021 rows=1 loops=1) | |
Output: count_type, count_id, (count + 1), ctid | |
Filter: ((counters.count_type = 0) AND (counters.count_id = 1)) | |
Rows Removed by Filter: 4 | |
Buffers: shared hit=5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test=# explain (analyze, buffers, verbose) update counters set count = count + 1 where count_type = 0 and count_id = 1; | |
QUERY PLAN ------------------------------------------------------------------------------------------------------------------ | |
Update on public.counters (cost=0.00..5.74 rows=15 width=18) (actual time=0.110..0.110 rows=0 loops=1) | |
Buffers: shared hit=20 | |
-> Seq Scan on public.counters (cost=0.00..5.74 rows=15 width=18) (actual time=0.014..0.054 rows=15 loops=1) | |
Output: count_type, count_id, (count + 1), ctid | |
Filter: ((counters.count_type = 0) AND (counters.count_id = 1)) | |
Rows Removed by Filter: 32 | |
Buffers: shared hit=5 | |
Total runtime: 0.137 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE counters ( | |
count_type INTEGER NOT NULL, | |
count_id INTEGER NOT NULL, | |
count INTEGER NOT NULL | |
); | |
-- later to fix the issue | |
ALTER TABLE counters ADD PRIMARY KEY (count_type, count_id); | |
CREATE TABLE primary_relation ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import time | |
import psycopg2 | |
COUNTERS = 5 | |
THREADS = 10 | |
ITERATIONS = 500 | |
def increment(): |
NewerOlder