Comment 7 for bug 1068426

Revision history for this message
Filippo Giunchedi (filippo) wrote :

(I'm currently working with Faidon, specifically on container-sync for our swift deployment)

I think more parallelism would help regardless when processing many containers, something like this (not an actual patch, just a sketch to explain the idea)

--- a/swift/container/sync.py
+++ b/swift/container/sync.py
@@ -21,6 +21,7 @@ from random import choice, random, shuffle
 from struct import unpack_from

 from eventlet import sleep, Timeout
+from eventlet.greenpool import GreenPool

 import swift.common.db
 from swift.container.backend import ContainerBroker, DATADIR
@@ -157,6 +158,7 @@ class ContainerSync(Daemon):
         self._myport = int(conf.get('bind_port', 6001))
         swift.common.db.DB_PREALLOCATION = \
             config_true_value(conf.get('db_preallocation', 'f'))
+ self.pool = GreenPool(int(conf.get('concurrency', 1)))

     def get_object_ring(self, policy_idx):
         """
@@ -178,9 +180,10 @@ class ContainerSync(Daemon):
                                                 mount_check=self.mount_check,
                                                 logger=self.logger)
             for path, device, partition in all_locs:
- self.container_sync(path)
+ self.pool.spawn_n(self.container_sync, path)
                 if time() - self.reported >= 3600: # once an hour
                     self.report()
+ self.pool.waitall()
             elapsed = time() - begin
             if elapsed < self.interval:
                 sleep(self.interval - elapsed)
@@ -195,9 +198,10 @@ class ContainerSync(Daemon):
                                             mount_check=self.mount_check,
                                             logger=self.logger)
         for path, device, partition in all_locs:
- self.container_sync(path)
+ self.pool.spawn_n(self.container_sync, path)
             if time() - self.reported >= 3600: # once an hour
                 self.report()
+ self.pool.waitall()
         self.report()
         elapsed = time() - begin
         self.logger.info(
--
2.1.1