Permalink
Browse files

Merge pull request #188 from Zapotek/master

Updated benchmarks to be operational again
  • Loading branch information...
2 parents 6b3b1a4 + d75c712 commit 6159c1643fc38e9a947c58834221856ed6fdf392 @igrigorik committed Apr 19, 2012
Showing with 47 additions and 33 deletions.
  1. +44 −30 benchmarks/clients.rb
  2. +3 −3 benchmarks/server.rb
View
@@ -9,7 +9,7 @@
require 'tach'
require 'typhoeus'
-url = 'http://127.0.0.1/10k.html'
+url = 'http://127.0.0.1:9292/data/10000'
with_server do
Tach.meter(100) do
@@ -119,38 +119,52 @@
streamly.get(url)
end
- tach('Typhoeus') do
- Typhoeus::Request.get(url).body
+ tach('Typhoeus') do |n|
+ hydra = Typhoeus::Hydra.new( max_concurrency: 8 )
+ hydra.disable_memoization
+ count = 0
+ error = 0
+ n.times {
+ req = Typhoeus::Request.new( url )
+ req.on_complete do |res|
+ count += 1
+ error += 1 if !res.success?
+ p [count, error] if count == n
+
+ end
+ hydra.queue( req )
+ }
+ hydra.run
end
end
end
-# +------------------------------+----------+
-# | tach | total |
-# +------------------------------+----------+
-# | em-http-request (persistent) | 0.016779 |
-# +------------------------------+----------+
-# | Excon (persistent) | 0.019606 |
-# +------------------------------+----------+
-# | curb (persistent) | 0.022034 |
-# +------------------------------+----------+
-# | Typhoeus | 0.027276 |
-# +------------------------------+----------+
-# | Excon | 0.034482 |
-# +------------------------------+----------+
-# | StreamlyFFI (persistent) | 0.036474 |
-# +------------------------------+----------+
-# | em-http-request | 0.041866 |
-# +------------------------------+----------+
-# | Net::HTTP (persistent) | 0.098379 |
-# +------------------------------+----------+
-# | Net::HTTP | 0.103786 |
-# +------------------------------+----------+
-# | RestClient | 0.111841 |
-# +------------------------------+----------+
-# | HTTParty | 0.118632 |
-# +------------------------------+----------+
-# | open-uri | 0.170172 |
-# +------------------------------+----------+
+#+------------------------------+-----------+
+#| tach | total |
+#+------------------------------+-----------+
+#| em-http-request (persistent) | 0.145512 |
+#+------------------------------+-----------+
+#| Excon | 0.181564 |
+#+------------------------------+-----------+
+#| RestClient | 0.253127 |
+#+------------------------------+-----------+
+#| Net::HTTP | 0.294412 |
+#+------------------------------+-----------+
+#| HTTParty | 0.305397 |
+#+------------------------------+-----------+
+#| open-uri | 0.307007 |
+#+------------------------------+-----------+
+#| Net::HTTP (persistent) | 0.313716 |
+#+------------------------------+-----------+
+#| Typhoeus | 0.514725 |
+#+------------------------------+-----------+
+#| curb (persistent) | 3.981700 |
+#+------------------------------+-----------+
+#| StreamlyFFI (persistent) | 3.989063 |
+#+------------------------------+-----------+
+#| Excon (persistent) | 4.018761 |
+#+------------------------------+-----------+
+#| em-http-request | 15.025291 |
+#+------------------------------+-----------+
View
@@ -32,17 +32,17 @@ def self.run
def with_server(&block)
pid = Process.fork do
- # Benchmark::Server.run
+ Benchmark::Server.run
end
loop do
sleep(1)
begin
- # Excon.get('http://localhost:9292/api/foo')
+ #Excon.get('http://localhost:9292/api/foo')
break
rescue
end
end
yield
ensure
Process.kill(9, pid)
-end
+end

0 comments on commit 6159c16

Please sign in to comment.