Sha256: ce8e11df35518355b364ad17144acf9cc0239e84f3286255691ed2cd9fbc5757

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'benchmark'

require '3scale/client'

provider_key = ENV['TEST_3SCALE_PROVIDER_KEY'] or raise 'No provider key set'
warn_deprecated = ENV['WARN_DEPRECATED'] == '1'

client = ThreeScale::Client.new(provider_key: provider_key,
                                warn_deprecated: warn_deprecated)
persistent_client = ThreeScale::Client.new(provider_key: provider_key,
                                           warn_deprecated: warn_deprecated,
                                           persistent: true)
persistent_ssl_client = ThreeScale::Client.new(provider_key: provider_key,
					       warn_deprecated: warn_deprecated,
                                               secure: true,
                                               persistent: true)
ssl_client = ThreeScale::Client.new(provider_key: provider_key,
                                    warn_deprecated: warn_deprecated,
                                    secure: true)

auth = { :app_id => ENV['TEST_3SCALE_APP_IDS'], :app_key => ENV['TEST_3SCALE_APP_KEYS'] }

N = 10

Benchmark.bmbm do |x|
  x.report('http') { N.times{ client.authorize(auth) } }
  x.report('http+persistent') { N.times{ persistent_client.authorize(auth) } }
  x.report('https+persistent') { N.times{ persistent_ssl_client.authorize(auth) } }
  x.report('https') { N.times{ ssl_client.authorize(auth) } }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
3scale_client-2.11.0 test/benchmark.rb