From 1b909e869724b8a8da20c4be9fe78d36cf692c1c Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 30 Jan 2019 03:57:55 +0000 Subject: [PATCH] ansible: pin connection multiplexer to a single core Nets a reliable 8% improvement in issue_140__thread_pileup.yml when targetting 64 Docker containers on the same 8 core/16 thread machine. Before: 2294528.731458 task-clock (msec) # 6.443 CPUs utilized 10,429,745 context-switches # 0.005 M/sec 2,049,618 cpu-migrations # 0.893 K/sec 8,258,952 page-faults # 0.004 M/sec 5,532,719,253,824 cycles # 2.411 GHz (83.35%) 4,001,276,805,120 stalled-cycles-frontend # 72.32% frontend cycles idle (83.30%) 2,024,159,442,463 stalled-cycles-backend # 36.59% backend cycles idle (66.65%) 3,267,471,616,230 instructions # 0.59 insn per cycle # 1.22 stalled cycles per insn (83.35%) 662,006,455,943 branches # 288.515 M/sec (83.33%) 39,453,895,977 branch-misses # 5.96% of all branches (83.37%) 356.148064576 seconds time elapsed After: 2208247.938562 task-clock (msec) # 6.735 CPUs utilized 8,489,840 context-switches # 0.004 M/sec 1,432,967 cpu-migrations # 0.649 K/sec 7,508,957 page-faults # 0.003 M/sec 5,477,293,750,357 cycles # 2.480 GHz (83.31%) 3,984,360,350,811 stalled-cycles-frontend # 72.74% frontend cycles idle (83.32%) 1,976,646,418,711 stalled-cycles-backend # 36.09% backend cycles idle (66.64%) 3,196,197,480,792 instructions # 0.58 insn per cycle # 1.25 stalled cycles per insn (83.36%) 648,247,332,967 branches # 293.557 M/sec (83.35%) 39,004,881,070 branch-misses # 6.02% of all branches (83.37%) 327.876903668 seconds time elapsed --- ansible_mitogen/process.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible_mitogen/process.py b/ansible_mitogen/process.py index b126323c..2037da0e 100644 --- a/ansible_mitogen/process.py +++ b/ansible_mitogen/process.py @@ -176,6 +176,7 @@ class MuxProcess(object): cls.child_sock = None mitogen.core.io_op(cls.worker_sock.recv, 1) else: + mitogen.utils.reset_affinity() cls.worker_sock.close() cls.worker_sock = None self = cls()