verm-client 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ce2084d3b2424bcc2e768dd946436af8e38925a
4
- data.tar.gz: 8be9a875f01d58e946f7c3671cf3178c01f7a922
3
+ metadata.gz: 7842cddb4253491aa3367dea8adc82f9e1f72af6
4
+ data.tar.gz: 00e2dd3ae0cc1ec10fc7078e67a3e19523fd3f1b
5
5
  SHA512:
6
- metadata.gz: 1d462b82e2eaaf10e7c466d020a02b94e592c1a76f842bb3cc667b0364b640451f85257c25d9acff3f092abe44e1612d18ee675283f2cc9124d0899b3bad1ac8
7
- data.tar.gz: 58294b9e7814e6fc2a5d2eb41acec6c53a43ac8fd5fb394295205c7fefea3d90041f6d25e58978fb7d08d81d3be4057b9ebb5e4f0f30884ae5d4b63db77b5921
6
+ metadata.gz: b55bac23d4ca297dad0cf96bacb229c97f1d34664dee5dc7c905b2735a4d36ddfe1d1e2123cbaaa3ef82b003ee0104af8aeceaf42e566338c25d17325804747f
7
+ data.tar.gz: 890a5df057851e3f0e747dca3632fd3aa5a0e3d49d745ad013de7f45dc43737fd4c8304a526a05d87ab37569f44f371f2320d3497c02c0fe74754b204e0cd7e3
data/lib/verm.rb CHANGED
@@ -1 +1,2 @@
1
+ require 'verm/http_no_delay'
1
2
  require 'verm/client'
data/lib/verm/client.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'net/http'
2
-
3
1
  module Verm
4
2
  class Client
5
3
  def self.incompressible_types
@@ -8,7 +6,7 @@ module Verm
8
6
 
9
7
  attr_reader :http_client
10
8
 
11
- def initialize(hostname, port: 3404, timeout: 15, http_class: Net::HTTP)
9
+ def initialize(hostname, port: 3404, timeout: 15, http_class: Net::HTTPNoDelay)
12
10
  @http_client = http_class.new(hostname, port)
13
11
  @http_client.open_timeout = timeout
14
12
  @http_client.read_timeout = timeout
@@ -0,0 +1,20 @@
1
+ require 'net/http'
2
+
3
+ # This class can be used as a workaround for Net::HTTP's lack of TCP_CORK/TCP_NOPUSH in sending
4
+ # requests. When using a Linux client and a Linux server we observe awful latency POSTing files on
5
+ # reused HTTP connections because Post class writes one block of data for the header and separate
6
+ # block(s) for the body. If the body is not sufficiently large to fill another packet itself, the
7
+ # Nagle algorithm will have Linux (by default) wait for the ACK from the first packet to be received
8
+ # back; unfortunately, this won't be sent immediately because of the Delayed ACK algorithm. As a
9
+ # result we typically observe 40ms of extra latency when POSTing small files. This class disables
10
+ # the Nagle algorithm to work around that. It's not an ideal fix because we would rather combine
11
+ # the write for the header with the write for the first N bytes of the body, but it should give
12
+ # performance better than the standard Ruby implementation in all cases because Nagle is of no
13
+ # benefit when queuing large blocks only to the OS (as both the streaming and non-streaming
14
+ # variants of the body write calls will do), and the way that Ruby is writing the header separately
15
+ # to the body means there will always be at least two packets anyway.
16
+ class Net::HTTPNoDelay < Net::HTTP
17
+ def on_connect()
18
+ @socket.io.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
19
+ end
20
+ end
data/lib/verm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Verm
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: verm-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-08-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Adds one-line methods for storing files in Verm and retrieving them again.
@@ -23,6 +23,7 @@ files:
23
23
  - Rakefile
24
24
  - lib/verm.rb
25
25
  - lib/verm/client.rb
26
+ - lib/verm/http_no_delay.rb
26
27
  - lib/verm/version.rb
27
28
  - test/fixtures/binary_file
28
29
  - test/fixtures/binary_file.gz