Skip to content

Add docs for rethinkdb proxy #11

Closed

Description

@jdoliner

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.

Activity

  1. neumino commented on Mar 28, 2014

    @neumino
    Member

    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:

    • 1 and 2 don't know about 3
    • 3 knows about 1 and 2 but can't connect to it.
  2. neumino commented on Mar 28, 2014

    @neumino
    Member
  3. coffeemug commented on Mar 28, 2014

    @coffeemug
    Contributor

    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.

  4. neumino commented on Mar 28, 2014

    @neumino
    Member

    Any objection if I close the docs issue?

  5. Tryneus commented on Mar 28, 2014

    @Tryneus
    Member

    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.

  6. coffeemug commented on Mar 28, 2014

    @coffeemug
    Contributor

    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.

  7. danielmewes commented on Nov 3, 2014

    @danielmewes
    Member

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

  8. coffeemug commented on Nov 3, 2014

    @coffeemug
    Contributor

    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.

  9. danielmewes commented on Nov 4, 2014

    @danielmewes
    Member

    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.

  10. coffeemug commented on Nov 4, 2014

    @coffeemug
    Contributor

    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)

  11. mlucy commented on May 26, 2015

    @mlucy
    Member

    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.
  12. larkost commented on May 27, 2015

    @larkost
    Collaborator

    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.

  13. chipotle commented on May 27, 2015

    @chipotle
    Contributor

    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?

  14. larkost commented on May 27, 2015

    @larkost
    Collaborator

    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.

  15. coffeemug commented on May 27, 2015

    @coffeemug
    Contributor

    a good pattern to have a rethinkdb proxy process running on each application server

    👍 that was the intention when we built it.

  16. danielmewes commented on Jun 1, 2015

    @danielmewes
    Member

    To update on my earlier comments about raft's impact on this: It seems like we will keep the proxy mode as it is for 2.1.

  17. danielmewes commented on Jun 5, 2015

    @danielmewes
    Member

    Really like the new documentation for the proxy mode. Very concise. 👍

  18. irony commented on Nov 12, 2015

    @irony

    For anyone using docker and rethinkdb, you need to use --bind-all on the proxy to make it accessible from your linked containers.

  19. ntquyen commented on Dec 9, 2015

    @ntquyen

    @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?

  20. danielmewes commented on Dec 9, 2015

    @danielmewes
    Member

    @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).

  21. jdoliner commented on Dec 9, 2015

    @jdoliner
    Author

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions