GithubHelp home page GithubHelp logo

mongoproxy's Introduction

#This is not actively developed, We (parse.com) wrote a more robust proxy look at https://github.com/facebookgo/dvara

This served well as an early prototype.

mongoproxy

MongoDB has a limit of 20,000 connections per node. When you have a lot of App-server talking to Mongo you will hit this limit. This problem gets worse in Forked-enviroments like Ruby's Unicorn where every app node opens multiple non sharable connections. To solve this we run a mongoproxy in the middle which acts converts m incoming connections to n outgoing connections to mongo keeping (m > n).

#Known Issues Before using in production look at the below issues and see if you can live with them

  • Mongo's GetLastError is local to the connection, the requests are made on, the proxy currently does not have any connection affinity and this breaks stuff.
  • Mongo ReplicaSet commands will return the original hosts and not the proxies in front of the host, this will cause the clients to talk to the actual mongo nodes and not proxies.

#Build

$ go get github.com/sheki/mongoproxy/cmd/mongoproxy

#Test

$ go get -t github.com/sheki/mongoproxy
$ go test github.com/sheki/mongoproxy

#Running the binary go get will place a 'mongoproxy' binary in the bin subdirectory of the first path in $GOPATH

Config/Flags

  • -dispatch_queue_len=10000: dispatch queue length
  • -listen_addr=":6000": address to listen for incomming requests
  • max_mongo_conn=100: max connections to mongo
  • -mongo_addr=":27017": address of the mongo to proxy
  • -read_timeout=10s: read time out for connections
  • -write_timeout=10s: write time out for connections

mongoproxy's People

Contributors

sheki avatar tmc avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

tmc 1399689727

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.