Skip to content

Instantly share code, notes, and snippets.

@bra-fsn
bra-fsn / defert.py
Last active June 3, 2016 07:05
defertothread benchmark
from twisted.internet import reactor
from twisted.internet.threads import deferToThread
from twisted.internet.defer import inlineCallbacks
from time import time
import sys
def func(a):
return a
@inlineCallbacks
from twisted.internet import reactor
from twisted.internet.threads import deferToThread
from twisted.internet.defer import inlineCallbacks
from time import time
from elasticsearch import Elasticsearch
import sys
es=Elasticsearch(['http://localhost:9201'],sniff_on_start=False,
sniff_on_connection_fail=False)
@bra-fsn
bra-fsn / treq_copy.py
Created May 4, 2017 13:31
HTTP copy between two URLs with treq
import treq
from twisted.internet import reactor
from twisted.web.iweb import IBodyProducer
from twisted.internet.defer import inlineCallbacks
from zope.interface import implements
class UploadProducer(object):
implements(IBodyProducer)
def __init__(self, get_resp):
@bra-fsn
bra-fsn / import
Last active July 5, 2019 08:21
zpool import vmstat -z good state
0
ITEM SIZE LIMIT USED FREE REQ FAIL SLEEP
UMA Kegs: 384, 0, 249, 1, 249, 0, 0
UMA Zones: 3712, 0, 266, 0, 266, 0, 0
UMA Slabs: 80, 0, 197827, 23, 199899, 0, 0
UMA Hash: 256, 0, 83, 37, 110, 0, 0
4 Bucket: 32, 0, 1639, 6486, 39648, 0, 0
6 Bucket: 48, 0, 1180, 6207, 35344, 0, 0
8 Bucket: 64, 0, 579, 5497, 19772, 11, 0