Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance issues with Ruby and Net::SCP transfers (sockets)
    primarykey
    data
    text
    <p>SCP upload speeds seem to be limited greatly in the library from what the command line scp utility is capable of. I understand this is Ruby (1.9.2-p0), but <strong>Net::SCP is approximately 8x slower than the Linux utility (seen using large files... see below).</strong> I'm curious to know (I took a quick look at the code) if this is how sockets are in Ruby, or if it's possible to multiplex the Net::SCP sockets better?</p> <p>I noticed that no matter what style of upload I tried (serial upload, channels operating asynchronously, using multiple instances of the scp object) I never could get over 9 megabytes / second transfer speed on an SCP upload. Now... let me explain the details of my investigation:</p> <p><strong>1) Tried Different Encryption Algorithms</strong></p> <p>I used different types of encryption without much significant speed change Example: I could submit my 1GB test file using command line scp (encryption algorithm = arcfour128) and get a transfer rate of 73.3 megabytes/s on my internal gigabit connection. I never got more than about 9 megabytes/s on my internal gigabit connection using the Net::SCP.upload lib.</p> <p><strong>2) Tried Different Hosts/OSes</strong></p> <p>I found that Linux -> Linux uploads were the fastest. SUA's ssh server (Windows) could only provide me with a maximum of 13.5megabytes/s upload speeds (Linux -> Windows, using arcfour algorithm w/ scp command line), whereas Linux -> Linux (using arcfour, w/ scp command line) was a blazing 73.3megabytes/s. I should mention that these Windows and Linux machines are the exact same model, hardware, etc.</p> <p><strong>3) Tried Different SCP upload methods</strong></p> <p>-> used 2 synchronous upload! calls, one after the other was finished. -> used 2 asynchronous upload calls, one after the other had started -> used 2 Net::SCP objects and submitted the file to the non-blocking/asynchronous version of upload (so they were running in parallel) None of these different methods give any significant performance gain, which is sort of frustrating.</p> <p>Here are the results of the test (text enhanced for readability, but similar to the output of the code provided):</p> <pre><code> Net::SCP Done creating channels Starting transfer of /home/seth/afpcases/systeme.afp # two upload! calls, one after another Finished transfer of /home/seth/afpcases/systeme.afp --> Duration: 126.07707 seconds (8.7168903909331 megabytes/s) should show transfer speed of serial uploads Starting transfer of /home/seth/afpcases/systeme.afp # two upload calls, one after another, with a wait on both channels after both have started Finished transfer of /home/seth/afpcases/systeme.afp --> Duration: 122.588784 seconds (8.964931082112699 megabytes/s) should show transfer speed of simultaneous async channels. Starting transfer of /home/seth/afpcases/systeme.afp # two upload calls on two separate Net::SCP objects, one after another, with a wait on both channels after both have started Finished transfer of /home/seth/afpcases/systeme.afp --> Duration: 122.822663 seconds (8.947860054133495 megabytes/s) should show transfer speed of simultaneous SCP instances Finished in 371.761262 seconds </code></pre> <p>If you have a large file (I used a ~1GB file), you can use these rspec tests (in scp_spec.rb) or change them to whatever test harnesses you are familiar with to see this performance degradation.</p> <p>If you don't know how this performance could be improved in the library, do you have any more ideas on how open up some extra parallel speed of SCP transfers besides just calling the scp utility via a subshell?</p> <p>Rspec test here: <a href="https://gist.github.com/703966" rel="noreferrer">https://gist.github.com/703966</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload