Skip to content

Instantly share code, notes, and snippets.

@cernceph
cernceph / mpa3.py
Created February 13, 2017 20:24
Matrix solution method for CRUSH Multipick anomaly
#!/usr/bin/env python
import random
from math import sqrt, log, pow
DEBUG = True
NPGS = 100000 # num PGs
R = 3 # num replicas
if NPGS > 3:
Num PGs: 100000
Num Replicas: 3
OSDs (id: weight): {0: 3.0, 1: 3.0, 2: 3.0, 3: 1.0}
Expected: {0: 90000.0, 1: 90000.0, 2: 90000.0, 3: 30000.0}
Replica 0: [30000.0, 30000.0, 30000.0, 10000.0]
Replica 1: [30000.0, 30000.0, 30000.0, 10000.0]
Replica 2: [30000.0, 30000.0, 30000.0, 10000.0]
Simulating with existing CRUSH
#!/usr/bin/env python
import random
from math import sqrt, log, pow
DEBUG = True
NPGS = 100000 # num PGs
R = 3 # num replicas
if NPGS > 3:
Num PGs: 100000
Num Replicas: 3
OSDs (id: weight): {0: 2.0, 1: 3.0, 2: 4.0, 3: 1.0}
Expected: {0: 60000.0, 1: 90000.0, 2: 120000.0, 3: 30000.0}
Replica 0: [20000.0, 30000.0, 40000.0, 10000.0]
Replica 1: [20000.0, 30000.0, 40000.0, 10000.0]
Replica 2: [20000.0, 30000.0, 40000.0, 10000.0]
Simulating with existing CRUSH
@cernceph
cernceph / mpa2.py
Last active February 9, 2017 16:40
#!/usr/bin/env python
import random
from math import sqrt, log, pow
DEBUG = True
NPGS = 100000 # num PGs
R = 3 # num replicas
if NPGS > 3:
@cernceph
cernceph / mpa.py
Last active February 7, 2017 09:12 — forked from anonymous/mpa.py
Simulation of the CRUSH Multi Pick Anomaly
#!/usr/bin/env python
import random
from math import sqrt, log, pow
DEBUG = True
NPGS = 100000 # num PGs
R = 3 # num replicas
if NPGS > 3:
@cernceph
cernceph / gist:4a03316a31ce7abe49167c392fc827da
Created June 10, 2016 11:43
haproxy multi backend radosgw config
frontend cs3.cern.ch-frontend-ssl
bind ipv4@:443,ipv6@:443 ssl no-sslv3 crt /etc/haproxy/cert.pem verify none
acl ha_stats url_beg /stats
acl pathstyle_buckets hdr(host) -i cs3.cern.ch
capture request header User-Agent len 256
capture request header Host len 128
http-request set-var(req.bucketname) path,word(1,/) if pathstyle_buckets
http-request set-var(req.bucketname) hdr(host),regsub(.cs3.cern.ch,) if ! pathstyle_buckets
http-request set-header X-Debug-Bucket %[var(req.bucketname)]
timeout http-request 5m