Changeset 24
- Timestamp:
- 06/10/09 16:32:58 (3 years ago)
- Files:
-
- lightcloud/lightcloud/__init__.py (modified) (1 diff)
- lightcloud/lightcloud/test/benchmark.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lightcloud/lightcloud/__init__.py
r22 r24 140 140 and deletes the key from lookup ring and storage node 141 141 """ 142 storage_node = locate_node(key, system)143 if not storage_node:144 storage_node = get_storage_ring(system).get_node(key)145 146 142 for i, lookup_node in enumerate(get_lookup_ring(system).iterate_nodes(key)): 147 if i > 1:143 if i > 0: 148 144 break 149 145 lookup_node.delete(key) 150 146 151 if storage_node: 147 for i, storage_node in enumerate(get_storage_ring(system).iterate_nodes(key)): 148 if i > 0: 149 break 152 150 storage_node.delete(key) 153 151 lightcloud/lightcloud/test/benchmark.py
r22 r24 27 27 def generic_bench(name, times_run, fn): 28 28 start = time() 29 print 'Running "%s" %s times...' % (name, times_run)30 29 for i in range(0, times_run): 31 30 fn() 32 print 'Finished "%s" in %s' % (name, time()-start) 33 print '------' 31 end = time()-start 32 pr_sec = float(times_run)/end 33 print 'Finished "%s" %s times in %0.2f sec [%0.1f operations pr.sec]' %\ 34 (name, times_run, end, pr_sec) 34 35 35 36 … … 40 41 lambda: lightcloud.set('hello', 'world', system='redis')) 41 42 43 print '------' 44 42 45 generic_bench('Tyrant get', 10000, 43 46 lambda: lightcloud.get('hello', system='tyrant')) 44 47 generic_bench('Redis get', 10000, 45 48 lambda: lightcloud.get('hello', system='redis')) 49 50 print '------' 46 51 47 52 generic_bench('Tyrant list_add', 10000, … … 50 55 lambda: lightcloud.list_add('hello_l', ['1'], system='redis')) 51 56 57 print '------' 58 52 59 generic_bench('Tyrant delete', 10000, 53 60 lambda: lightcloud.delete('hello', system='tyrant'))
