$ numactl -C 16-35 memtier_benchmark -p 2222 -P memcache_binary -n 20000 -t 20 -c 10
go 1.5 / GOMAXPROCS=15
20 Threads
10 Connections per thread
20000 Requests per thread
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 io | |
from msgpack import fallback, packb | |
try: | |
from msgpack import _unpacker, _packer | |
has_ext = True | |
except ImportError: | |
has_ext = False | |
import timeit |
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
""" | |
Compress FileHandler output with subprocess gzip. | |
""" | |
import subprocess | |
import logbook | |
from logbook.helpers import is_unicode | |
class GZFileHandler(logbook.FileHandler): |
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 `TEST` ( | |
`id` int(11) DEFAULT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
INSERT INTO TEST (id) VALUES (1) (2) (3); |
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
from __future__ import print_function | |
import json | |
bdata = b'{"foo0": "bar0","foo1": "bar1","foo2": "bar2","foo3": "bar3","foo4": "bar4","foo5": "bar5","foo6": "bar6"}' | |
udata = u'{"foo0": "bar0","foo1": "bar1","foo2": "bar2","foo3": "bar3","foo4": "bar4","foo5": "bar5","foo6": "bar6"}' | |
def decode_b(): | |
json.loads(bdata) |
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 signal | |
import socket | |
import threading | |
import time | |
try: | |
import socketserver | |
except ImportError: | |
import SocketServer as socketserver |
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
$ go test -bench=. -benchmem | |
PASS | |
BenchmarkAnswer3 1000000 1248 ns/op 344 B/op 6 allocs/op | |
BenchmarkAnswer4 2000000 836 ns/op 128 B/op 1 allocs/op |
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 cProfile | |
import requests | |
import time | |
import pycohttpp.monkeypatch | |
def run_with_profile(): | |
prof = cProfile.Profile() | |
prof.enable() | |
run() | |
prof.disable() |
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
diff --git a/packets.go b/packets.go | |
index f39d65c..290a388 100644 | |
--- a/packets.go | |
+++ b/packets.go | |
@@ -603,8 +603,13 @@ func (rows *textRows) readRow(dest []driver.Value) error { | |
// EOF Packet | |
if data[0] == iEOF && len(data) == 5 { | |
+ rows.mc = nil | |
return io.EOF |
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
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go | |
index 1ce679d..2ccf7b3 100644 | |
--- a/src/database/sql/sql.go | |
+++ b/src/database/sql/sql.go | |
@@ -21,6 +21,7 @@ import ( | |
"sort" | |
"sync" | |
"sync/atomic" | |
+ "time" | |
) |