Skip to content

abtreece/typhoid

Repository files navigation

Typhoid

Exploration and benchmarking of Ruby HTTP client libraries — comparing Typhoeus (libcurl via FFI), HTTP.rb, httpx, Excon, httpclient, and Faraday adapters.

Setup

Requires Ruby 3.4.1.

bundle install

Scripts

bundle exec ruby benchmark.rb        # benchmark HTTP clients against a local server
bundle exec ruby typhoid.rb          # Typhoeus request with response callbacks
bundle exec ruby faraday_adapter.rb  # Faraday 2 + Typhoeus adapter
bundle exec ruby ffi.rb              # FFI function binding (libc getpid/getuid/getgid)

Benchmark

Compares sequential and concurrent request throughput across Ruby HTTP clients. Runs against a local WEBrick server to isolate client overhead from network latency.

$ bundle exec ruby benchmark.rb
100 sequential requests, 20 concurrent for Hydra/httpx

                                user     system      total        real
net_http (sequential):      0.030987   0.027114   0.058101 (  0.060819)
typhoeus (sequential):      0.027921   0.006180   0.034101 (  0.032995)
typhoeus hydra (20x):       0.018413   0.008402   0.026815 (  0.025023)
httpclient (sequential):    0.017611   0.009057   0.026668 (  0.024709)
http.rb (sequential):       0.025343   0.022475   0.047818 (  0.050925)
excon (sequential):         0.015554   0.007385   0.022939 (  0.021729)
httpx (sequential):         0.035922   0.013852   0.049774 (  0.049687)
httpx (20x):                0.017343   0.006821   0.024164 (  0.022185)

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages