Giter VIP home page Giter VIP logo

rack-latency's Introduction

Rack::Latency

10:06:49 web.1  | at=info source=yahoo measure#response.size=9 measure#response.latency=130.86ms
10:06:53 web.1  | at=info source=google measure#response.size=11 measure#response.latency=60.65ms
10:06:53 web.1  | at=info source=yahoo measure#response.size=9 measure#response.latency=122.92ms
10:06:57 web.1  | at=info source=google measure#response.size=11 measure#response.latency=53.46ms
10:06:57 web.1  | at=info source=yahoo measure#response.size=9 measure#response.latency=129.75ms
10:07:01 web.1  | at=info source=google measure#response.size=11 measure#response.latency=58.56ms

This gem measures request latency to other hosts. It runs as a separate thread created by its own middleware. If you're running multiple apps that talk to each other, it's a good way to sniff out potential network problems.

On my system, the head measurement times are roughly equivalent to (maybe 10-20% faster than) curl -I.

Installation and Configuration

Add gem 'rack-latency' to your app's Gemfile. Then create an initializer to specify your desired measurements:

# config/initializers/rack-latency.rb
Rack::Latency.configure do |measure|
  # time a HEAD request for google.com.
  measure.head "http://www.google.com/" 

  # time a GET request to a Yahoo IP, and rename the measurement to "yahoo".
  measure.get "http://98.138.253.109/", name: "yahoo" 

  # set the delay time between measurement loops.
  measure.wait ENV["RACK-LATENCY-WAIT"] || 4

  # set the environment(s) in which to run, as defined by Rails.env or RACK_ENV.
  # By default, it will only run in production.
  measure.environment :production
  # or
  measure.environments :production, :staging
end

Contributing

  1. Fork it ( http://github.com//rack-latency/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

rack-latency's People

Contributors

chadbailey59 avatar svc-scm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

silasb

rack-latency's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.