Code Monkey home page Code Monkey logo

thrift_client's Introduction

thrift_client

A Thrift client wrapper that encapsulates some common failover behavior.

License

Copyright 2009 Twitter, Inc. See included LICENSE file.

The public certificate for this gem is here.

Features

  • Transparent connection management

  • Configurable failover and retry backoff

  • Ruby 1.9 compatibility

  • ThriftClient::Simple class, for working without generated bindings.

The Github source repository is here. Patches and contributions are very welcome.

Usage

Instantiate a client:

client = ThriftClient.new(CassandraRb::Client, '127.0.0.1:9160', :retries => 2)

You can then make calls to the server via the client instance as if was your internal Thrift client. The connection will be opened lazily and methods will be proxied through.

client.get_string_list_property("keyspaces")

On failures, the client will try the remaining servers in the list before giving up. See ThriftClient for more.

Timeouts

Timeouts are enforced per-try, so if you have a timeout of n and do m retries, the total time it could take is n*m.

Connection Handling

The library will shuffle the host list then work its way down this list, only moving to the next host if it received an error or you’ve doing more than server_max_requests requests with that host (defaults to 0 which means there’s no limit).

Servers that throw an error get marked as dead and will only be retried every server_retry_period seconds (at that time all dead servers are retried, no matter long they’ve been marked as dead).

Installation

You need Ruby 1.8 or 1.9. If you have those, just run:

sudo gem install thrift_client

Contributing

To contribute changes:

  1. Fork the project

  2. make your change, adding tests

  3. send a pull request to fauna and ryanking

Reporting problems

The Github issue tracker is here.

thrift_client's People

Contributors

cgs avatar freels avatar jmhodges avatar kristianmandrup avatar mperham avatar ryanking avatar vangberg avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.