multiprocessing adds latency; default to off

This commit is contained in:
ed 2020-05-16 02:05:18 +02:00
parent 94ad1f5732
commit 47bc8bb466
3 changed files with 6 additions and 4 deletions

View file

@ -129,7 +129,9 @@ def main():
ap.add_argument("-i", metavar="IP", type=str, default="0.0.0.0", help="ip to bind")
ap.add_argument("-p", metavar="PORT", type=int, default=1234, help="port to bind")
ap.add_argument("-nc", metavar="NUM", type=int, default=16, help="max num clients")
ap.add_argument("-j", metavar="CORES", type=int, help="max num cpu cores")
ap.add_argument(
"-j", metavar="CORES", type=int, default=1, help="max num cpu cores"
)
ap.add_argument("-a", metavar="ACCT", type=str, action="append", help="add account")
ap.add_argument("-v", metavar="VOL", type=str, action="append", help="add volume")
ap.add_argument("-q", action="store_true", help="quiet")

View file

@ -29,7 +29,7 @@ class BrokerMp(object):
self.mutex = threading.Lock()
cores = self.args.j
if cores is None:
if not cores:
cores = mp.cpu_count()
self.log("broker", "booting {} subprocesses".format(cores))

View file

@ -129,8 +129,8 @@ class SvcHub(object):
return None
def check_mp_enable(self):
if self.args.j == 0:
self.log("root", "multiprocessing disabled by argument -j 0;")
if self.args.j == 1:
self.log("root", "multiprocessing disabled by argument -j 1;")
return False
if mp.cpu_count() <= 1: