GithubHelp home page GithubHelp logo

Expose ability to reconnect about nats.go HOT 6 CLOSED

nats-io avatar nats-io commented on July 29, 2024
Expose ability to reconnect

from nats.go.

Comments (6)

krobertson avatar krobertson commented on July 29, 2024

How are you using the nats client? It will reconnect out of the box, however be aware it has a few reconnect settings you may want to switch, like MaxReconnect and ReconnectWait. If you are having an issue, you may be hitting the default max reconnect number.

from nats.go.

krobertson avatar krobertson commented on July 29, 2024

One other thing to add... nats behind HAProxy, are you running it in clustered mode? If not, it will produce some odd issues as not all clients will be on the same system. But with clustered, haproxy really isn't necessary. You can simply configure the clients with the list of all the NATS servers, and have them pick a random one rather than just the first one.

from nats.go.

chendo avatar chendo commented on July 29, 2024

We want to have the ability to reconnect so we can rebalance the connections to another gnatsd server. A disconnect won't preserve the subscriptions.

We are running it in clustered mode. I have a fork that lets us dynamically add and remove routes to the cluster, so we can dynamically scale gnatsd up and down. HAProxy does the balancing and the config is automatically generated and updated via Marathon.

The problem comes when the machines that gnatsd are on die for some reason, and the clients all reconnect to the existing one, but when the replacements are spun back up, the connections are unbalanced to the one that survived.

from nats.go.

krobertson avatar krobertson commented on July 29, 2024

Were you hitting scaling limits with gnatsd? Although rebalancing can help and it avoids clumping on a single gnatsd server, can also be clumped or gated with haproxy itself.

While haproxy just proxies data, it may be that the latency from the added network hop ends ip costing more than an unbalanced set of clients.

from nats.go.

chendo avatar chendo commented on July 29, 2024

Not yet, but I suspect we will at some point.

Our setup has haproxy running on every Mesos worker, so haproxy is always
on localhost, then it picks the least connections for a backend. This
doesn't guarantee that it gets sent to the least loaded backend as haproxy
doesn't share state with others but in our tests, it has been good enough.

On Saturday, March 7, 2015, Ken Robertson [email protected] wrote:

Were you hitting scaling limits with gnatsd? Although rebalancing can help
and it avoids clumping on a single gnatsd server, can also be clumped or
gated with haproxy itself.

While haproxy just proxies data, it may be that the latency from the added
network hop ends ip costing more than an unbalanced set of clients.


Reply to this email directly or view it on GitHub
#50 (comment).

Sent from my iPhone.

from nats.go.

derekcollison avatar derekcollison commented on July 29, 2024

We will add rebalancing via gnatsd at some point in the future, most likely when we introduce the gossip protocol for clustering that will also transfer to the clients.

from nats.go.

Related Issues (20)

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.