GithubHelp home page GithubHelp logo

isabella232 / em-resolv-replace Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wooga/em-resolv-replace

0.0 0.0 0.0 20 KB

EventMachine-aware pure Ruby DNS resolution

License: MIT License

Ruby 100.00%

em-resolv-replace's Introduction

em-resolv-replace

EventMachine-aware DNS lookup for Ruby.

Ruby’s stock DNS resolution, by default, blocks the entire Ruby VM from processing while the lookup is happening, because it calls out to the native libc resolver code. A slow DNS server can cause your entire Ruby process to grind to a halt. Ruby comes with a pure Ruby replacement that is not loaded by default:

require 'resolv'
require 'resolv-replace'

‘resolv’ is the pure Ruby DNS resolver. ‘resolv-replace’ monkeypatches the various Ruby Socket objects to use resolv. This gem monkeypatches the monkeypatch so that the Socket classes will use an EventMachine-aware resolver, em-dns-resolver.

Requirements

em-resolv-replace requires Ruby 1.9.

Installation

gem install em-resolv-replace

Usage

Just require em-resolv-replace when initializing your application:

require 'em-resolv-replace'

The code will use the EM-aware resolver if EventMachine is running.

Credits

em-dns-resolver.rb is taken from the em-dns project, with a connection bugfix applied by myself, and was written by Aman Gupta and Stephan Maka.

Author

Mike Perham, @mperham, mperham AT gmail.com, github.com/mperham

em-resolv-replace's People

Contributors

ivanukhov avatar leifbladt avatar mperham avatar samleb avatar stakach avatar

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.