Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created June 18, 2014 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mumumu/28b3bfa6c119b0368250 to your computer and use it in GitHub Desktop.
Save mumumu/28b3bfa6c119b0368250 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from multiprocessing import Pool
import redis
MAX_LOOP_COUNT = 100
db = redis.StrictRedis(host='localhost', port=6379, db=0)
db.delete('hoge')
def test(dummy):
pipe = db.pipeline()
for i in range(MAX_LOOP_COUNT):
pipe.incr('hoge')
return pipe.execute()
if __name__ == '__main__':
p = Pool(2)
print sorted(p.map(test, [1, 2]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment