Skip to content

Commit c81f5f1

Browse files
committed
profiler & input: Add backpressure by lowering maxsize of profiler queue to avoid OOM kills
1 parent 1c3c3a0 commit c81f5f1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

managers/process_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self, main):
5353
# to pass flows to the profiler
5454
# this max size is decided based on the avg size of each flow and
5555
# tha max memory (4g) that this queue is allowed to use
56-
self.profiler_queue = Queue(maxsize=5162220)
56+
self.profiler_queue = Queue(maxsize=50000)
5757
self.termination_event: Event = Event()
5858
# to make sure we only warn the user once about
5959
# the pending modules

slips_files/core/profiler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,12 @@ def init(
101101
self.stop_profiler_workers_event = multiprocessing.Event()
102102
# each msg received from inputprocess will be put here, and each one
103103
# profiler worker will retrieve msgs from this queue.
104-
# the goal of this is to have main() handle the stop msg.
104+
# the goal of this q is to have main() handle the stop msg.
105105
# so without this, only 1 of the 3 workers receives the stop msg
106106
# and exits, and the rest of the 2 workers AND the main() keep
107107
# waiting for new msgs
108-
self.flows_to_process_q = multiprocessing.Queue(maxsize=5162220)
108+
109+
self.flows_to_process_q = multiprocessing.Queue(maxsize=50000)
109110
self.handle_setting_local_net_lock = multiprocessing.Lock()
110111
self.is_first_msg = True
111112
# runs a separate server process behind the scenes.

0 commit comments

Comments
 (0)