Created
November 24, 2012 15:28
-
-
Save mocobeta/4140135 to your computer and use it in GitHub Desktop.
KVS性能比較/データ
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
## memcached, Couchbase 両方で使用 | |
import pylibmc | |
import md5 | |
import time | |
host = 'host:port' | |
mc = pylibmc.Client([host]) | |
ITEM_COUNT = 1000000 | |
for i in range(0, ITEM_COUNT): | |
key = md5.new(str(i)).hexdigest() | |
val = key * 4 | |
mc.set(key, val) | |
print 'Done.' |
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 pymongo | |
import md5 | |
import time | |
host = 'host:port' | |
conn = pymongo.Connection([host]) | |
db = conn.test | |
ITEM_COUNT = 1000000 | |
for i in range(0, ITEM_COUNT): | |
key = md5.new(str(i)).hexdigest() | |
val = key * 4 | |
data = {'_id': key, 'val': val} | |
db.mycoll.save(data, safe=True) | |
print 'Done.' |
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 redis | |
import md5 | |
import time | |
host = 'host' | |
port = port | |
rc = redis.Redis(host, port) | |
ITEM_COUNT = 1000000 | |
for i in range(0, ITEM_COUNT): | |
key = md5.new(str(i)).hexdigest() | |
val = key * 4 | |
rc.set(key, val) | |
print 'Done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment