Antonio Terceiro <terce...@debian.org> wrote:
> On Fri, Jul 08, 2016 at 06:53:29PM +0000, Eric Wong wrote:
> > Thanks for the report.  Can you try the patch below?
> 
> Didn't help.
> 
> I can't, however, reproduce this locally on my workstation.

Thanks for following up.

> > I'd be interested to know what non-standard sysctl knobs are set
> > for kernel socket buffer sizes (in /proc/sys/net/{core,ipv4}/*mem*)
 
> ==> /proc/sys/net/ipv4/tcp_rmem <==
> 4096    12582912        16777216
> 
> ==> /proc/sys/net/ipv4/tcp_wmem <==
> 4096    12582912        16777216

Yikes at the gigantic default (middle) values.  Anyways, I've
set those locally and notice the problem with my previous patch:
I missed some spots where temporary strings/arrays were created
inside the tests themselves.

> In Debian we don't even have 2.2 anymore. The only things using kgio are
> unicorn and rainbows. Maybe if their dependency on kgio could be skipped on
> Ruby 2.3, we could drop kgio from Debian.

Yes, I still have to check and make sure I don't introduce
performance regressions and such when dropping kgio.
I still need to support Ruby 1.9.3 and 2.0.0 outside of Debian
(or on wheezy LTS/jessie)

The following ought to work (I tested locally with those sysctl
values) but I'll see about making the tests more robust against
larger kernel buffers.

-------8<--------
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -7,7 +7,12 @@ $-w = true
 require 'kgio'
 
 module LibReadWriteTest
-  RANDOM_BLOB = File.open("/dev/urandom") { |fp| fp.read(10 * 1024 * 1024) }
+  RANDOM_BLOB = File.open("/dev/urandom") do |fp|
+    nr = 31
+    buf = fp.read(nr)
+    # get roughly a 20MB block of random data
+    (buf * (20 * 1024 * 1024 / nr)) + (buf * rand(123))
+  end
 
   def teardown
     @rd.close if defined?(@rd) && ! @rd.closed?
@@ -369,7 +374,7 @@ module LibReadWriteTest
       @nr += 1
       IO.select(nil, [self])
     end
-    buf = "." * 1024 * 1024 * 10
+    buf = RANDOM_BLOB
     thr = Thread.new { @wr.kgio_write(buf) }
     Thread.pass until thr.stop?
     readed = @rd.read(buf.size)
@@ -385,7 +390,7 @@ module LibReadWriteTest
       @nr += 1
       IO.select(nil, [self])
     end
-    buf = ["." * 1024] * 1024 * 10
+    buf = [ RANDOM_BLOB, RANDOM_BLOB ]
     buf_size = buf.inject(0){|c, s| c + s.size}
     thr = Thread.new { @wr.kgio_writev(buf) }
     Thread.pass until thr.stop?
-- 
EW

Reply via email to