Created
December 29, 2012 15:36
-
-
Save clofresh/4407618 to your computer and use it in GitHub Desktop.
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
$ python test_mcache.py | |
no monkeypatch | |
Start mem: 7491584 End mem: 41394176 Difference 33902592 | |
$ python test_mcache.py monkeypatch | |
monkeypatch | |
Start mem: 7491584 End mem: 7491584 Difference 0 |
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 os | |
import sys | |
import memcache | |
import psutil | |
def spawn_clients(num): | |
for i in xrange(num): | |
m = memcache.Client(['localhost:11211']) | |
def run(): | |
p = psutil.Process(os.getpid()) | |
start = p.get_memory_info() | |
print 'Start mem:', start.rss, | |
spawn_clients(10000) | |
end = p.get_memory_info() | |
print 'End mem:', end.rss, 'Difference', end.rss - start.rss | |
if sys.argv[-1] == 'monkeypatch': | |
print 'monkeypatch' | |
memcache.Client.debuglog = None | |
else: | |
print 'no monkeypatch' | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment