Performance problem for nil string in SSLSocket.sysread
-------------------------------------------------------

                 Key: JRUBY-2597
                 URL: http://jira.codehaus.org/browse/JRUBY-2597
             Project: JRuby
          Issue Type: Bug
          Components: OpenSSL, Performance
         Environment: jruby 1.1.2 and ruby 1.8.6
            Reporter: Brian Tatnall


If data provided to any SSL request is nil then the request takes a very long 
time.  I followed the data all the way to 
SSLSocket.sysread in jopenssl.

require 'net/https'
require 'benchmark'

# Only effects SSL
# Effects get requests as well haven't checked put and delete

def request(data)
  connection = Net::HTTP.new("www.google.com", 443)
  connection.use_ssl = true
  connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
  connection.start do |connection|
    connection.request_post("/tbproxy/spell?lang=en", data, { 'User-Agent' => 
"Test", 'Accept' => 'text/xml' })
  end
end

puts "is nil: #{Benchmark.measure { request(nil) }.to_s.chomp} 
[#{RUBY_PLATFORM}]"
puts "is not: #{Benchmark.measure { request(" ") }.to_s.chomp} 
[#{RUBY_PLATFORM}]"

Output I'm seeing when running with ruby and then jruby:
is nil:    0.000000   0.010000   0.010000 (  0.067843) [x86_64-linux]
is not:   0.000000   0.000000   0.000000 (  0.107844) [x86_64-linux]
is nil:  10.454000   0.000000  10.454000 ( 10.454042) [java]
is not:   0.191000   0.000000   0.191000 (  0.192685) [java]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to