You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We don't have any docs for rethinkdb proxy and it's actually a very useful feature that I've described to a number of people over IRC and had them be delighted. Let's add docs for it.
Can someone explain to me what's a use case for rethinkdb proxy?
I get what it does I think, but I can't think of what to do with it.
I thought about using it to create to join two network to create a virtual network, but that doesn't work. It's the same problem as setting a ssh tunnel between two networks.
If I have 2 machines 1 and 2 in network A, start rethinkdb proxy on network A with --bind all, and have a machine 3 in network B that joins the proxy, I get:
The proxy command comes from the olden days when we didn't quite understand software as well as we thought we did. I think we should just delete it, and add connection pools to the client drivers instead.
I still think rethinkdb proxy is useful for a few situations. First, you can effectively separate the query parsing from the cache/storage layer. That is, if you have a node that has a slow disk, but want to utilize its CPU and RAM, you can throw a proxy onto it. In addition, you can have a proxy as an entry-point for queries into the cluster, which allows you to have to one place that clients can connect to without putting extra load onto the data servers (if that is your bottleneck), while still being assured that the node itself is not hosting data.
I think the fact that literally not a single person has asked for such a thing or bothered to implement it in practice is a strong, strong data point against the proxy command. Also, we never actually empirically validated our assumptions about performance impact.
A handful of people has asked about this in the meantime.
I suggest we wait documenting this until we ship Raft though. In the Raft release, we will also have a kind of "arbiter" mode. In that mode, a RethinkDB server will be able to participate in Raft elections, but not hold any data itself. I have no idea how we will expose that feature, but it feels like it might cause us to rethink the details of the proxy mode as well (it could just be a regular RethinkDB node with a special tag, or it could be something similar to what are now proxy nodes, or it could in fact be an extension of the existing proxy mode, in which case we would rename it).
I have some strong gut reactions to these features (that might be wrong):
I think we should drop proxy entirely and move most of its functionality into connection pools.
I'm not sure if we should have machines with an arbiter role but no other roles. This would result in specializing nodes (some nodes do X, other nodes do Y), which can be confusing from a UX perspective.
We should talk about this when we get to the point of actually designing this.
We should probably discuss this elsewhere, but just to avoid some confusion: rethinkdb proxy is quite different from a connection pool.
They have one use case in common: If some server in the cluster dies, the connection will automatically be routed to a different node (this assumes that the proxy server runs on the same machine as the application server and they never die independently from each other).
However arguably the main use case of rethinkdb proxy is to reduce network traffic, latency and overhead by routing queries directly to the right node(s). A connection pool cannot do this.
A connection pool has a completely different main use case, which is reducing the overhead of connection setup. A rethinkdb proxy node cannot do this.
That being said, reducing the degree of special casing for rethinkdb proxy would be really good. We cannot just make it a regular cluster node right now because of how the cluster behaves if one of its members go down (and proxy nodes should be allowed to go down). This is going to change with the Raft transition, and at that point I imagine we can get rid of the special proxy node. Users could still get the same functionality by starting a regular server with a special tag that isn't used for any tables.
However arguably the main use case of rethinkdb proxy is to reduce network traffic, latency and overhead by routing queries directly to the right node(s).
My argument is that we should drop support for this because in practice it's much less useful than we think. (We can discuss the details at another time and another place, just wanted to state my opinion here)
Now that we have changefeeds, rethinkdb proxy is extremely useful because it lets us deduplicate changefeed traffic between the actual cluster and the machine hosting the clients. I think we should probably keep it, and should definitely document it in the meantime. (If we decide not to keep it, we should make sure we have another way of deduplicating changefeed messages before dropping it.)
@chipotle asked for a brief overview of what rethinkdb proxy does. Basically it adds a node to the cluster that doesn't store any data. So you can run this node on the same machine as your clients and connect to it over localhost. This has three main uses:
It can save intracluster network traffic by routing your query straight to the correct machine.
It can do some processing itself, lessening CPU load on machines that store data on disk.
It can deduplicate changefeed messages send to it by other nodes in the cluster.
In addition to the points @mlucy mentioned, a rethinkdb proxy node is also aware of other nodes that might become unavailable so is the best tool we have to keep a stable connection to the cluster when things go bad.
Personally I see the poxy nodes as becoming more and more important as our ability to scale increases.
So: if you have a RethinkDB cluster, you can set up a proxy node on your application server and have the application connect to the proxy rather than to a (non-proxy) machine on the cluster. The proxy will route queries more efficiently, deduplicate changefeed messages and make sure queries don't get sent to unavailable nodes.
If you have more than one application server in this scenario, should each application server run its own proxy, or should there be only one machine running rethinkdb proxy in a cluster?
I talked to @chipotle in person, and my answer is that in a big setup it would be a good pattern to have a rethinkdb proxy process running on each application server. This is especially true the more you use changefeeds.
@larkost and @coffeemug In a microservice system running containers, in my case is kubernetes. Should I have each microservice use its own rethinkdb proxy inside the pod? My concern is that could make hundreds of rethinkdb proxy, could that make the rethinkdb cluster performance worse or not at all?
@ntquyen We haven't really tested anything of that scale. I suspect that there won't be any problems if you stay below 100 proxies or so, but there might be some unexpected slowdowns when getting to a multitude of that.
Also note that proxies are not completely light-weight. While they need less RAM than "proper" RethinkDB servers, and don't need any storage, they will still need a significant amount of RAM for processing queries (depending on which types of queries you're running).
@ntquyen imo this is a great use case for a daemon controller [0]
That will give you a rethinkdb proxy per node rather than per pod. It should have the same performance characteristics but you won't have to worry about scaling up your controller slowing down the db.
Activity
neumino commentedon Mar 28, 2014
Can someone explain to me what's a use case for rethinkdb proxy?
I get what it does I think, but I can't think of what to do with it.
I thought about using it to create to join two network to create a virtual network, but that doesn't work. It's the same problem as setting a ssh tunnel between two networks.
If I have 2 machines 1 and 2 in network A, start
rethinkdb proxyon network A with--bind all, and have a machine 3 in network B that joins the proxy, I get:neumino commentedon Mar 28, 2014
ping @coffeemug @Tryneus
coffeemug commentedon Mar 28, 2014
The
proxycommand comes from the olden days when we didn't quite understand software as well as we thought we did. I think we should just delete it, and add connection pools to the client drivers instead.neumino commentedon Mar 28, 2014
Any objection if I close the docs issue?
Tryneus commentedon Mar 28, 2014
I still think
rethinkdb proxyis useful for a few situations. First, you can effectively separate the query parsing from the cache/storage layer. That is, if you have a node that has a slow disk, but want to utilize its CPU and RAM, you can throw a proxy onto it. In addition, you can have a proxy as an entry-point for queries into the cluster, which allows you to have to one place that clients can connect to without putting extra load onto the data servers (if that is your bottleneck), while still being assured that the node itself is not hosting data.coffeemug commentedon Mar 28, 2014
I think the fact that literally not a single person has asked for such a thing or bothered to implement it in practice is a strong, strong data point against the proxy command. Also, we never actually empirically validated our assumptions about performance impact.
danielmewes commentedon Nov 3, 2014
A handful of people has asked about this in the meantime.
I suggest we wait documenting this until we ship Raft though. In the Raft release, we will also have a kind of "arbiter" mode. In that mode, a RethinkDB server will be able to participate in Raft elections, but not hold any data itself. I have no idea how we will expose that feature, but it feels like it might cause us to rethink the details of the proxy mode as well (it could just be a regular RethinkDB node with a special tag, or it could be something similar to what are now proxy nodes, or it could in fact be an extension of the existing proxy mode, in which case we would rename it).
coffeemug commentedon Nov 3, 2014
I have some strong gut reactions to these features (that might be wrong):
proxyentirely and move most of its functionality into connection pools.We should talk about this when we get to the point of actually designing this.
danielmewes commentedon Nov 4, 2014
We should probably discuss this elsewhere, but just to avoid some confusion:
rethinkdb proxyis quite different from a connection pool.They have one use case in common: If some server in the cluster dies, the connection will automatically be routed to a different node (this assumes that the proxy server runs on the same machine as the application server and they never die independently from each other).
However arguably the main use case of
rethinkdb proxyis to reduce network traffic, latency and overhead by routing queries directly to the right node(s). A connection pool cannot do this.A connection pool has a completely different main use case, which is reducing the overhead of connection setup. A
rethinkdb proxynode cannot do this.That being said, reducing the degree of special casing for
rethinkdb proxywould be really good. We cannot just make it a regular cluster node right now because of how the cluster behaves if one of its members go down (and proxy nodes should be allowed to go down). This is going to change with the Raft transition, and at that point I imagine we can get rid of the special proxy node. Users could still get the same functionality by starting a regular server with a special tag that isn't used for any tables.coffeemug commentedon Nov 4, 2014
My argument is that we should drop support for this because in practice it's much less useful than we think. (We can discuss the details at another time and another place, just wanted to state my opinion here)
mlucy commentedon May 26, 2015
Now that we have changefeeds,
rethinkdb proxyis extremely useful because it lets us deduplicate changefeed traffic between the actual cluster and the machine hosting the clients. I think we should probably keep it, and should definitely document it in the meantime. (If we decide not to keep it, we should make sure we have another way of deduplicating changefeed messages before dropping it.)@chipotle asked for a brief overview of what
rethinkdb proxydoes. Basically it adds a node to the cluster that doesn't store any data. So you can run this node on the same machine as your clients and connect to it over localhost. This has three main uses:larkost commentedon May 27, 2015
In addition to the points @mlucy mentioned, a
rethinkdb proxynode is also aware of other nodes that might become unavailable so is the best tool we have to keep a stable connection to the cluster when things go bad.Personally I see the
poxynodes as becoming more and more important as our ability to scale increases.chipotle commentedon May 27, 2015
So: if you have a RethinkDB cluster, you can set up a proxy node on your application server and have the application connect to the proxy rather than to a (non-proxy) machine on the cluster. The proxy will route queries more efficiently, deduplicate changefeed messages and make sure queries don't get sent to unavailable nodes.
If you have more than one application server in this scenario, should each application server run its own proxy, or should there be only one machine running
rethinkdb proxyin a cluster?larkost commentedon May 27, 2015
I talked to @chipotle in person, and my answer is that in a big setup it would be a good pattern to have a
rethinkdb proxyprocess running on each application server. This is especially true the more you use changefeeds.coffeemug commentedon May 27, 2015
👍 that was the intention when we built it.
danielmewes commentedon Jun 1, 2015
To update on my earlier comments about raft's impact on this: It seems like we will keep the
proxymode as it is for 2.1.danielmewes commentedon Jun 5, 2015
Really like the new documentation for the proxy mode. Very concise. 👍
irony commentedon Nov 12, 2015
For anyone using docker and rethinkdb, you need to use --bind-all on the proxy to make it accessible from your linked containers.
ntquyen commentedon Dec 9, 2015
@larkost and @coffeemug In a microservice system running containers, in my case is kubernetes. Should I have each microservice use its own
rethinkdb proxyinside the pod? My concern is that could make hundreds ofrethinkdb proxy, could that make the rethinkdb cluster performance worse or not at all?danielmewes commentedon Dec 9, 2015
@ntquyen We haven't really tested anything of that scale. I suspect that there won't be any problems if you stay below 100 proxies or so, but there might be some unexpected slowdowns when getting to a multitude of that.
Also note that proxies are not completely light-weight. While they need less RAM than "proper" RethinkDB servers, and don't need any storage, they will still need a significant amount of RAM for processing queries (depending on which types of queries you're running).
jdoliner commentedon Dec 9, 2015
@ntquyen imo this is a great use case for a daemon controller [0]
That will give you a rethinkdb proxy per node rather than per pod. It should have the same performance characteristics but you won't have to worry about scaling up your controller slowing down the db.
[0] https://github.com/kubernetes/kubernetes/blob/master/docs/admin/daemons.md