Skip to content

Commit

Permalink
Add comments for future development
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Nov 27, 2014
1 parent 2e141f8 commit 221577b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/drnbench/request-response/runner.rb
Expand Up @@ -84,6 +84,8 @@ def setup_child_process
child_read, parent_write = IO.pipe
@child_process_pipes << [parent_read, parent_write]

# Prepare request queue for child process at first
# to reduce needless inter-process communications (IPC) while running!
child_process_requests_queue = Queue.new
n_requests_per_process.times.each do |index|
child_process_requests_queue.push(@requests_queue.pop)
Expand All @@ -104,6 +106,7 @@ def setup_child_process
message = child_read.gets
if message and message.chomp == MESSAGE_EXIT
clients.each(&:stop)
# We also should reduce IPC for results.
@result.each do |result|
@parent.push_result(result)
end
Expand Down

0 comments on commit 221577b

Please sign in to comment.