Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How many Host I need to instantiate? #226

Closed
marimcmurtrie opened this issue Jun 20, 2018 · 2 comments
Closed

How many Host I need to instantiate? #226

marimcmurtrie opened this issue Jun 20, 2018 · 2 comments
Assignees
Labels

Comments

@marimcmurtrie
Copy link
Contributor

marimcmurtrie commented Jun 20, 2018

Hi, I just started leaning this. I am a bit confused about Host and connection pool. I need help for clarification.

I have Dynomite cluster in remote servers. See below. Details here: Netflix/dynomite#569

  • data center:"dc1"

    • rack1:"dc1_rack1"
      • node1 - host:216.11.111.1, token:2147483647
      • node2 - host:216.11.111.1, token:4294967294
  • data center:"dc2"

    • rack1:"dc2_rack1"
      • node1 - host:216.22.222.2, token: 1383429731
    • rack2:"dc2_rack2"
      • node1 - host: 216.22.222.2, token: 2147483647
      • node2 - host:216.22.222.2, token: 4294967294

I write client code with DynoJedis. I have questions about this client-side code. I generate own tokenMap:

[
  {
    "token": "2147483647",
    "hostname": "216.11.111.1",
    "zone": "dc1_rack1",
    "dc": "dc1"
  },
  {
    "token": "4294967294",
    "hostname": "216.11.111.1",
    "zone": "dc1_rack1",
    "dc": "dc1"
  },
  {
    "token": "1383429731",
    "hostname": "216.22.222.2",
    "zone": "dc2_rack1",
    "dc": "dc2"
  },
  {
    "token": "2147483647",
    "hostname": "216.22.222.2",
    "zone": "dc2_rack2",
    "dc": "dc2"
  },
  {
    "token": "4294967294",
    "hostname": "216.22.222.2",
    "zone": "dc2_rack2",
    "dc": "dc2"
  }
]
  1. How many Host objects do I have to instantiate? I have 2 data centers and total of 5 nodes.
    (a) Do I need only 1 Host object for a given cluster?
    (b) 2 Host objects because I use 2 hosts for this cluster?
    (c) 5 Host objects since I have 5 nodes? That is probably not the case.

  2. What the port should be when I instantiate the Host object? Should it be one of ports the nodes LISTEN to? I know default port is 8102.

  3. Suppose only 1 Host is needed for HostSupplier, then doesn't it mean that all requests from a client goes to 1 node? I know if the first node does not have data, then it passes the request around, but if the initial requests all go to 1 node, then the node gets too busy, doesn't it? Or is the connection pool smart enough to handle that complexity?

Thanks for help!!

@marimcmurtrie
Copy link
Contributor Author

I quickly read AWS and its terminology (region, availability_zone, etc). Is there an assumption that 1 host contains only 1 rack? That is why we instantiate Host with 1 rack with 1 port (this is LISTEN port of one of the nodes in the rack).? I set up my Dynomite so that 1 host contains multiple racks. If this is the case, then how many Host objects should I instantiate? Thanks.

@marimcmurtrie
Copy link
Contributor Author

@ipapapa answered this in gitter so I close this issue.
How many Host I need -> "one, there is a connection pool underneath. Dyno opens connections to all nodes in the same datacenter. The connections are kept in the connection pool, so if a node goes down Dyno does not have pay the penalty to reopen a connection."

@ipapapa ipapapa self-assigned this Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants