{"id":20288,"date":"2013-05-10T12:46:11","date_gmt":"2013-05-10T07:16:11","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=20288"},"modified":"2024-04-12T14:16:40","modified_gmt":"2024-04-12T08:46:40","slug":"host-proximity-by-snitch","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/","title":{"rendered":"Host proximity by snitch"},"content":{"rendered":"<p><a class=\"vsc\" href=\"http:\/\/www.vskills.in\/certification\/Certified-Cassandra-Professional\"><span class=\"vsc-cn\" style=\"text-align: center;\"><span style=\"color: red;\">Certify and Increase Opportunity.<\/span><br \/>\n<span style=\"color: green;\">Be <\/span><br \/>\nGovt. Certified Apache Cassandra Professional<br \/>\n<\/span><\/a><\/p>\n<p><strong>Host proximity by snitch<\/strong><\/p>\n<p>Cassandra uses two items, snitches and strategies, to determine which nodes will receive copies of data. Snitches define proximity of nodes within the ring. Strategies use the information snitches provide them about node proximity along with an implemented algorithm to collect nodes that will receive writes.<\/p>\n<p>There are two types snitches &#8211;<strong> SimpleSnitch &amp; SimpleStrategy<\/strong><\/p>\n<p>SimpleSnitch literally has no locality information about nodes, it just returns a list of all the nodes in a ring. SimpleStrategy will attempt to start writing data to the first node whose token is larger than the tokens data. If there are no nodes whose token is larger than the data&#8217;s token, it will start at the node with the smallest token.<\/p>\n<p>Lets say we have four nodes in our Cassandra ring with a token range of 0-100 and our intial tokens are assigned as follows: d-&gt;0, a-&gt;25, b-&gt;50, c-&gt;75. If we try to place data that has a token of 19, SimpleStrategy will ask for the list of nodes from SimpleSnitch, then it will write to the first node whose token is larger, which in this case is node a. If we had a replication factor of 2 (two copies of data should be written), SimpleStrategy will simply continue gathering the next highest token value node. So our second copy would go to node b.<\/p>\n<p>This is one of the most common types of distribution methods that people implement with Cassandra: even token distribution between nodes so that each owns 25% of the data.<\/p>\n<p><strong>Smarter Snitches and Strategies<\/strong><br \/>\nCassandra has another Snitch called PropertyFileSnitch which maintains much more information about nodes within the ring. PropertyFileSnitch maintains a mapping of node, datacenter, and rack so that we can determine, for any node, what data center it is in, and what rack within that datacenter it is in. This information is statically defined in cassandra-topology.properties.<\/p>\n<p>There is also a Strategy that is made to use the information from a PropertyFileSnitch called NetworkTopologyStrategy (NTS). The NTS algorithm is implemented as follows:<\/p>\n<ul>\n<li>Get Datacenters from strategy options: {DC0:1,DC1:1}<\/li>\n<li>For each data center entry<\/li>\n<\/ul>\n<ol>\n<li>Get replication factor<\/li>\n<li>Get a list of all endpoints for this datacenter from the snitch<\/li>\n<li>Create a ringIterator from the datacenter endpoints list and Collect endpoints to write to \u2013 only select an endpoint from the list for any given rack once (distribute across racks)<\/li>\n<li>If replication factor has not been met, continue to collect endpoints from the list, allowing racks that already contain an endpoint in the write list<\/li>\n<\/ol>\n<ul>\n<li>If our replication factor is not equal to our list of endpoints, throw an error because there are not enough nodes in the data center to meet the replication factor<\/li>\n<\/ul>\n<p>There is a lot of important stuff going on here (see the presentation slides for more in depth coverage of what is going on internally), but to keep it brief, the key difference is that instead of iterating over an entire set of nodes in the ring, NTS creates an iterator for EACH datacenter and places writes discretely for each. The result is that NTS basically breaks each datacenter into it&#8217;s own logical ring when it places writes.<\/p>\n<div class=\"apply\">\n<h3>Apply for Apache Cassandra Certification Now!!<\/h3>\n<p><a href=\"http:\/\/www.vskills.in\/certification\/Certified-Cassandra-Professional\">http:\/\/www.vskills.in\/certification\/Certified-Apache-Cassandra-Professional<\/a><\/p>\n<h4>Go To Tutorial- <a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/apache-cassandra-professional\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Certified Apache Cassandra Professional Tutorial<\/strong><\/a><\/h4>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Certify and Increase Opportunity. Be Govt. Certified Apache Cassandra Professional Host proximity by snitch Cassandra uses two items, snitches and strategies, to determine which nodes will receive copies of data. Snitches define proximity of nodes within the ring. Strategies use the information snitches provide them about node proximity along with an implemented algorithm to collect&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[63],"tags":[],"class_list":["post-20288","page","type-page","status-publish","hentry","category-apache-cassandra"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Host proximity by snitch - Tutorial<\/title>\n<meta name=\"description\" content=\"Host proximity by snitch. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Host proximity by snitch - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Host proximity by snitch. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:46:40+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/\",\"name\":\"Host proximity by snitch - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2013-05-10T07:16:11+00:00\",\"dateModified\":\"2024-04-12T08:46:40+00:00\",\"description\":\"Host proximity by snitch. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Host proximity by snitch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Host proximity by snitch - Tutorial","description":"Host proximity by snitch. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/","og_locale":"en_US","og_type":"article","og_title":"Host proximity by snitch - Tutorial","og_description":"Host proximity by snitch. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:46:40+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/","name":"Host proximity by snitch - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2013-05-10T07:16:11+00:00","dateModified":"2024-04-12T08:46:40+00:00","description":"Host proximity by snitch. Vskills Government Certification in Apache Cassandra is very popular in India amongst developers working in the IT Bid data industry.","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/host-proximity-by-snitch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Host proximity by snitch"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/20288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=20288"}],"version-history":[{"count":11,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/20288\/revisions"}],"predecessor-version":[{"id":83395,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/20288\/revisions\/83395"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=20288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=20288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=20288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}