yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] test_client_expire: favor Process.spawn over fork+exec
@ 2015-07-21 21:39 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-07-21 21:39 UTC (permalink / raw)
  To: yahns-public

Process.spawn is faster under Linux since it may use vfork
to avoid marking pages copy-on-write.
---
 test/test_client_expire.rb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/test_client_expire.rb b/test/test_client_expire.rb
index 4f20803..c23a727 100644
--- a/test/test_client_expire.rb
+++ b/test/test_client_expire.rb
@@ -125,9 +125,8 @@ class TestClientExpire < Testcase
     opts = { out: "/dev/null", err: "/dev/null", close_others: true }
     begin
       pids = 2.times.map do
-        fork do
-          exec(*%W(ab -c #{nr} -n 9999999 -v1 -k http://#{host}:#{port}/), opts)
-        end
+        Process.spawn(*%W(ab -c #{nr} -n 9999999 -v1 -k
+                          http://#{host}:#{port}/), opts)
       end
 
       re1 = %r{consider raising open file limits}
-- 
EW


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-21 21:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 21:39 [PATCH] test_client_expire: favor Process.spawn over fork+exec Eric Wong

Code repositories for project(s) associated with this inbox:

	../../../yahns.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).