1 00:00:00,150 --> 00:00:04,290 ‫So let's assume I have three shots and that's the example we're going to build, by the way, guys, 2 00:00:04,530 --> 00:00:05,910 ‫on the example part of it. 3 00:00:06,860 --> 00:00:14,300 ‫And and these three three databases, let's say I have an important one, right? 4 00:00:14,810 --> 00:00:23,510 ‫So the idea of consistent things you take in and put or a strand or any user provided piece of data 5 00:00:23,510 --> 00:00:29,630 ‫that you can't you want to query on and you want to know which database to query on, essentially that 6 00:00:29,630 --> 00:00:34,800 ‫hash, you're going to give you back that instance somehow. 7 00:00:34,850 --> 00:00:35,220 ‫Right. 8 00:00:35,390 --> 00:00:37,190 ‫So let's say hashing of inputs. 9 00:00:37,190 --> 00:00:39,440 ‫One will give you a database. 10 00:00:39,440 --> 00:00:40,460 ‫Five, four, three, two. 11 00:00:40,490 --> 00:00:42,100 ‫You got here. 12 00:00:42,290 --> 00:00:47,980 ‫So every time you submit the inputs one string, it will always goes to this database. 13 00:00:47,990 --> 00:00:48,210 ‫Right. 14 00:00:48,380 --> 00:00:52,680 ‫And if you submit to somehow this goes to five, four, three, three. 15 00:00:52,820 --> 00:00:53,180 ‫Right. 16 00:00:53,390 --> 00:00:58,190 ‫And then if you have an the three that might go to server five, four, three, four. 17 00:00:58,220 --> 00:00:58,520 ‫Right. 18 00:00:58,520 --> 00:01:00,380 ‫Which is listening report five, four, three, four. 19 00:01:00,380 --> 00:01:02,520 ‫And then that's kind of a consistent fashion. 20 00:01:02,540 --> 00:01:06,140 ‫So as long as you give me always the same story, I'm going to make sure. 21 00:01:06,710 --> 00:01:07,010 ‫Right. 22 00:01:07,280 --> 00:01:14,000 ‫To always consistently hash that to the same server, to the same node, essentially. 23 00:01:15,410 --> 00:01:21,650 ‫And you might get another like I say again, if you submit and input to again, you can always get the 24 00:01:21,650 --> 00:01:23,630 ‫same output. 25 00:01:23,630 --> 00:01:24,050 ‫Right. 26 00:01:24,470 --> 00:01:24,800 ‫All right. 27 00:01:24,810 --> 00:01:28,650 ‫So how much you want is like how does actually this work? 28 00:01:28,670 --> 00:01:34,520 ‫So one implementation would be just, hey, make this input into some sort for no. 29 00:01:34,580 --> 00:01:34,820 ‫Right. 30 00:01:34,940 --> 00:01:37,190 ‫I don't know how you do this sum. 31 00:01:37,190 --> 00:01:43,940 ‫All this character ASCII codes convert into a binary and then shove it back to a decimal and then do 32 00:01:43,940 --> 00:01:44,900 ‫a modulo. 33 00:01:44,990 --> 00:01:50,060 ‫Right, which is the remainder of three because I have three nodes and then the input is like, I don't 34 00:01:50,060 --> 00:01:52,090 ‫know if it happened to be ten. 35 00:01:52,130 --> 00:01:52,600 ‫Right. 36 00:01:52,610 --> 00:01:54,680 ‫Let's say you got ten, ten. 37 00:01:54,680 --> 00:01:57,170 ‫Modula Three years or I divide it by three. 38 00:01:57,170 --> 00:02:00,350 ‫That's three and then nine and it's up to the remainder of one. 39 00:02:00,350 --> 00:02:00,650 ‫Right. 40 00:02:00,830 --> 00:02:07,310 ‫So one is you add back five, four, three, two and that equals to five, four, three, three, and 41 00:02:07,310 --> 00:02:08,690 ‫that goes to the server. 42 00:02:08,700 --> 00:02:10,920 ‫So that's how one implementation. 43 00:02:10,940 --> 00:02:12,590 ‫I'm not saying that is right. 44 00:02:12,800 --> 00:02:14,330 ‫And we're going to use one implementation. 45 00:02:14,330 --> 00:02:16,880 ‫And Norges, that does consistent hashing. 46 00:02:16,880 --> 00:02:18,730 ‫Essentially, they get an input. 47 00:02:18,950 --> 00:02:23,570 ‫Give me the port no back so I can connect to my database. 48 00:02:23,570 --> 00:02:24,170 ‫And yeah. 49 00:02:24,170 --> 00:02:26,960 ‫And that is called the hash rank as well. 50 00:02:27,510 --> 00:02:27,810 ‫Right. 51 00:02:28,010 --> 00:02:29,660 ‫So this is like almost like a ring. 52 00:02:29,660 --> 00:02:34,850 ‫And then you start, Cassandre, use this all the time with the shards that they have. 53 00:02:34,850 --> 00:02:35,240 ‫Right. 54 00:02:35,450 --> 00:02:37,580 ‫That consistent hashing ring essentially. 55 00:02:37,730 --> 00:02:41,210 ‫So every time you have an input, I know which which database to hit.