Created
July 18, 2011 04:31
Revisions
-
James Dennis revised this gist
Jul 18, 2011 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import eventlet pymongo = eventlet.import_patched('pymongo') ### Setup database connection dbc = pymongo.Connection() -
James Dennis created this gist
Jul 18, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/usr/bin/env python ### ### Concurrent pymongo inserts ### import eventlet pymongo = eventlet.import_patched('pymongo') from pymongo.errors import AutoReconnect ### Setup database connection dbc = pymongo.Connection() db = dbc.test ### Prepare concurrent resources pool = eventlet.GreenPool(1000) def do(*args, **kwargs): db.test_coll.insert(*args) dbc.end_request() for i in xrange(1000): pool.spawn_n(do, {'num': i}) pool.waitall()