{"id":1615,"date":"2020-09-10T08:00:54","date_gmt":"2020-09-10T15:00:54","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=1615"},"modified":"2020-09-09T14:28:56","modified_gmt":"2020-09-09T21:28:56","slug":"build-fault-tolerant-applications-cassandra","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/build-fault-tolerant-applications-cassandra\/","title":{"rendered":"Build fault tolerant applications with Cassandra API for Azure Cosmos DB"},"content":{"rendered":"<p><a href=\"http:\/\/www.azurecosmosdb.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Azure Cosmos DB<\/a> is a resource governed system that allows you to execute a certain number of operations per second based on the <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/set-throughput\" target=\"_blank\" rel=\"noopener noreferrer\">provisioned throughput<\/a> you have configured. If clients exceed that limit and consume more <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/request-units\">request units<\/a> than what was provisioned, it leads to rate limiting of subsequent requests and exceptions being thrown &#8211; they are also referred to as <u><span class=\"TextRun Underlined BCX0 SCXW162359280\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun BCX0 SCXW162359280\"><a class=\"Hyperlink BCX0 SCXW162359280\" href=\"https:\/\/docs.microsoft.com\/rest\/api\/cosmos-db\/http-status-codes-for-cosmosdb\" target=\"_blank\" rel=\"noreferrer noopener\">429 errors.<\/a><\/span><\/span><\/u><\/p>\n<p><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">With the help of a practical example, I&#8217;ll<\/span><\/span>\u00a0<span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">demonstrate how to <\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">incorporate<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0fault-toleran<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">ce in your\u00a0<\/span><\/span><a class=\"Hyperlink SCXW30641833 BCX0\" href=\"https:\/\/golang.org\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">Go<\/span><\/span><\/a><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0applications by\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">handl<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">ing<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0and retrying operations affected by these<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0rate limiting\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">errors<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">.<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 GrammarErrorHighlight SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">To help you follow along, the<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0sample application\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">code\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">for this blog<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">is\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">available<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><a class=\"Hyperlink SCXW30641833 BCX0\" href=\"https:\/\/github.com\/abhirockzz\/cosmos-go-rate-limiting\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">on GitHub<\/span><\/span><\/a><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0and it\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">uses<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0the<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><a class=\"Hyperlink SCXW30641833 BCX0\" href=\"https:\/\/github.com\/gocql\/gocql\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">gocql<\/span><\/span><span class=\"TextRun MacChromeBold Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">\u00a0<\/span><\/span><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">driver for<\/span><\/span><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">\u00a0<\/span><\/span><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">Apache\u00a0<\/span><\/span><span class=\"TextRun Underlined SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-charstyle=\"Hyperlink\">Cassandra<\/span><\/span><\/a><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">.\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">In this post, we&#8217;ll<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">go\u00a0<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">through<\/span><\/span><span class=\"TextRun SCXW30641833 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW30641833 BCX0\" data-ccp-parastyle=\"code-line\">:<\/span><\/span><span class=\"EOP SCXW30641833 BCX0\" data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"250\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"none\">I<\/span><span data-contrast=\"none\">nitial<\/span><span data-contrast=\"none\">\u00a0setup<\/span><span data-contrast=\"none\">\u00a0and configuration<\/span><span data-contrast=\"none\">\u00a0before\u00a0<\/span><span data-contrast=\"none\">running the\u00a0<\/span><span data-contrast=\"none\">sample application<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"250\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"none\">Execution of v<\/span><span data-contrast=\"none\">arious l<\/span><span data-contrast=\"none\">oad<\/span><span data-contrast=\"none\">\u00a0test scenarios<\/span><span data-contrast=\"none\">\u00a0and\u00a0<\/span><span data-contrast=\"none\">analyze the results<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"250\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"none\">A quick overview of the R<\/span><span data-contrast=\"none\">etry Policy implementation<\/span><span data-contrast=\"none\">.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">One way<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">of<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0tackl<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">ing<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0rate limiting<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\"> is<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0by adjusting<\/span><\/span> <span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">provisioned throughput\u00a0<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">to meet you<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">r<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0application requirements. There\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW232800444 BCX0\">are<\/span><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0<\/span><\/span><a class=\"Hyperlink SCXW232800444 BCX0\" href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/manage-scale-cassandra#manage-scaling\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\" data-ccp-charstyle=\"Hyperlink\">multiple ways to do this<\/span><\/span><\/a><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">, including using A<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">zure portal,\u00a0<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">Azure\u00a0<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">CLI<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">, and <\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">CQL<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0(Cassandra Query Language)<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">commands<\/span><\/span><span class=\"TextRun SCXW232800444 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW232800444 BCX0\">.<\/span><\/span><span class=\"EOP SCXW232800444 BCX0\" data-ccp-props=\"{&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<h4><span class=\"TextRun MacChromeBold SCXW131900980 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW131900980 BCX0\">But,<\/span><span class=\"NormalTextRun SCXW131900980 BCX0\">\u00a0w<\/span><\/span><span class=\"TextRun MacChromeBold SCXW131900980 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW131900980 BCX0\">hat if you wanted to handle these errors in the application itself?<\/span><\/span><span class=\"EOP SCXW131900980 BCX0\" data-ccp-props=\"{&quot;134233118&quot;:true,&quot;335559738&quot;:450}\">\u00a0<\/span><\/h4>\n<p><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\" data-ccp-parastyle-defn=\"{&quot;ObjectId&quot;:&quot;66502b49-d30f-41a1-8aeb-dd974c1203c5|222&quot;,&quot;Properties&quot;:[134233117,&quot;true&quot;,134233118,&quot;true&quot;,134233614,&quot;true&quot;,201340122,&quot;2&quot;,335559705,&quot;2057&quot;,469769226,&quot;Times New Roman&quot;,469775450,&quot;code-line&quot;,469777841,&quot;Times New Roman&quot;,469777842,&quot;Times New Roman&quot;,469777843,&quot;Times New Roman&quot;,469777844,&quot;Times New Roman&quot;,469778129,&quot;code-line&quot;,469778324,&quot;Normal&quot;],&quot;ClassId&quot;:1179649}\">The good thing is that the Cassandra API for Azure Cosmos DB translates\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">the\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">rate limiting<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">exceptions<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">in<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">to overloaded errors on the Cassandra native protocol<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">.\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">Since<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0the\u00a0<\/span><\/span><code><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">gocql<\/span><\/span><\/code><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">driver allows you to\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">plugin<\/span><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0your own<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><a class=\"Hyperlink SCXW61971650 BCX0\" href=\"https:\/\/pkg.go.dev\/github.com\/gocql\/gocql?tab=doc#RetryPolicy\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-charstyle=\"Hyperlink\">RetryPolicy<\/span><\/span><\/a><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">,<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">you can write a custom<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0implementation\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">to intercept the<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">se\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">errors and<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0retry them<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0after\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">a\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">certain<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0(cool down)<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0time period.\u00a0<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">This policy<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0can<\/span><\/span><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0then\u00a0<\/span><\/span><a class=\"Hyperlink SCXW61971650 BCX0\" href=\"https:\/\/pkg.go.dev\/github.com\/gocql\/gocql?tab=doc#Query.RetryPolicy\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-charstyle=\"Hyperlink\">be applied\u00a0<\/span><\/span><span class=\"TextRun Underlined SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-charstyle=\"Hyperlink\">to each Query<\/span><\/span><\/a><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">\u202for at a global level using a\u202f<\/span><\/span><a class=\"Hyperlink SCXW61971650 BCX0\" href=\"https:\/\/pkg.go.dev\/github.com\/gocql\/gocql?tab=doc#ClusterConfig\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-charstyle=\"Hyperlink\">ClusterConfig<\/span><\/span><\/a><span class=\"TextRun SCXW61971650 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW61971650 BCX0\" data-ccp-parastyle=\"code-line\">.<\/span><\/span><span class=\"EOP SCXW61971650 BCX0\" data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<p><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\" data-ccp-parastyle-defn=\"{&quot;ObjectId&quot;:&quot;66502b49-d30f-41a1-8aeb-dd974c1203c5|222&quot;,&quot;Properties&quot;:[134233117,&quot;true&quot;,134233118,&quot;true&quot;,134233614,&quot;true&quot;,201340122,&quot;2&quot;,335559705,&quot;2057&quot;,469769226,&quot;Times New Roman&quot;,469775450,&quot;code-line&quot;,469777841,&quot;Times New Roman&quot;,469777842,&quot;Times New Roman&quot;,469777843,&quot;Times New Roman&quot;,469777844,&quot;Times New Roman&quot;,469778129,&quot;code-line&quot;,469778324,&quot;Normal&quot;],&quot;ClassId&quot;:1179649}\">The<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u202f<\/span><\/span><a class=\"Hyperlink SCXW187725446 BCX0\" href=\"https:\/\/github.com\/Azure\/azure-cosmos-cassandra-extensions\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">Azure Cosmos DB extension<\/span><\/span><\/a><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u202f<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">library<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">makes it quite\u00a0<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">easy<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0to\u00a0<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">use<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0Retry Polic<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">i<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">es in your Java applications<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">.\u00a0<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">An equivalent Go version\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">is<\/span><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0<\/span><\/span><a class=\"Hyperlink SCXW187725446 BCX0\" href=\"https:\/\/github.com\/abhirockzz\/cosmos-cassandra-go-extension\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-charstyle=\"Hyperlink\">available on GitHub<\/span><\/span><\/a><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0and has been used in\u00a0<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">the<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0sample application for this blog post<\/span><\/span><span class=\"TextRun SCXW187725446 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW187725446 BCX0\" data-ccp-parastyle=\"code-line\">.<\/span><\/span><span class=\"EOP SCXW187725446 BCX0\" data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<h3><span class=\"TextRun SCXW105984710 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW105984710 BCX0\" data-ccp-parastyle=\"heading 2\">Retry\u00a0<\/span><\/span><span class=\"TextRun SCXW105984710 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW105984710 BCX0\" data-ccp-parastyle=\"heading 2\">P<\/span><\/span><span class=\"TextRun SCXW105984710 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW105984710 BCX0\" data-ccp-parastyle=\"heading 2\">olicy in action<\/span><\/span><\/h3>\n<p><span data-contrast=\"none\">As promised, you will\u00a0<\/span><span data-contrast=\"none\">walk\u00a0<\/span><span data-contrast=\"none\">through the entire process using a simple yet practical example.\u00a0<\/span><span data-contrast=\"none\">The<\/span><span data-contrast=\"none\">\u00a0sample application<\/span><span data-contrast=\"none\">\u00a0used to demonstrate the concepts is a service<\/span><span data-contrast=\"none\"> that exposes a REST endpoint to <\/span><code>POST<\/code>\u202forders<span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">data which is persisted to\u00a0<\/span><span data-contrast=\"none\">a Cassandra table in\u00a0<\/span><span data-contrast=\"none\">Azure\u00a0<\/span><span data-contrast=\"none\">Cosmos DB.<\/span><span data-ccp-props=\"{&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">You<\/span><span data-contrast=\"none\">\u00a0will run a few load tests on this API service to see how rate limiting manifests itself and how it&#8217;s handled.<\/span><span data-ccp-props=\"{&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<h4>Pre-requisites<span data-ccp-props=\"{}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"none\">Start by installing\u202f<\/span><a href=\"https:\/\/github.com\/rakyll\/hey\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">hey<\/span><\/a><span data-contrast=\"none\">, a load testing program. You can download OS specific binaries (64-bit) for <a href=\"https:\/\/storage.googleapis.com\/hey-release\/hey_linux_amd64\" target=\"_blank\" rel=\"noopener noreferrer\">Linux<\/a>, <a href=\"https:\/\/storage.googleapis.com\/hey-release\/hey_darwin_amd64\" target=\"_blank\" rel=\"noopener noreferrer\">Mac<\/a> and <a href=\"https:\/\/storage.googleapis.com\/hey-release\/hey_windows_amd64\" target=\"_blank\" rel=\"noopener noreferrer\">Windows<\/a> <\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">please<\/span><span data-contrast=\"none\"> refer to\u202f<a href=\"https:\/\/github.com\/rakyll\/hey#installation\" target=\"_blank\" rel=\"noopener noreferrer\">the GitHub repo<\/a><\/span><span data-contrast=\"none\">\u202ffor latest information in case you face issues downloading the utility<\/span><span data-contrast=\"none\">)<\/span><\/p>\n<p><div class=\"alert alert-success\">You can use any other tool that allows you to generate load on an HTTP endpoint <\/div><\/p>\n<p><span data-contrast=\"none\">Clone this GitHub repo and change into the right directory:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;134233279&quot;:true}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">git clone github.com\/abhirockzz\/cosmos-go-rate-limiting\u00a0\r\ncd cosmos-go-rate-limiting<\/pre>\n<h4><\/h4>\n<h4><span class=\"TextRun SCXW19363774 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW19363774 BCX0\" data-ccp-parastyle=\"heading 2\">Setup<\/span><\/span><span class=\"TextRun SCXW19363774 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW19363774 BCX0\" data-ccp-parastyle=\"heading 2\"> Azure Cosmos DB<\/span><\/span><\/h4>\n<p><span class=\"TextRun SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">Create a<\/span><\/span><span class=\"TextRun SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">n\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 GrammarErrorHighlight SCXW66669942 BCX0\">Azure<\/span><\/span><span class=\"TextRun SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">\u202f<\/span><\/span><a class=\"Hyperlink SCXW66669942 BCX0\" href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/create-cassandra-api-account-java#create-a-database-account\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">Cosmos DB account<\/span><\/span><\/a><span class=\"TextRun SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">\u202fwith the\u202f<\/span><\/span><span class=\"TextRun MacChromeBold SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">Cassandra API<\/span><\/span><span class=\"TextRun SCXW66669942 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW66669942 BCX0\">\u202foption selected<\/span><\/span><span class=\"EOP SCXW66669942 BCX0\" data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" class=\"wp-image-1623 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/create-cosmos-300x268.png\" alt=\"Image create cosmos\" width=\"544\" height=\"486\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/create-cosmos-300x268.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/create-cosmos-1024x915.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/create-cosmos-768x686.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/create-cosmos-1536x1373.png 1536w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/create-cosmos.png 1804w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h5><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\">Create a K<\/span><span class=\"NormalTextRun SpellingErrorV2 SCXW57311952 BCX0\">eyspace<\/span><span class=\"NormalTextRun SCXW57311952 BCX0\"> and<\/span><\/span><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\"> Table<\/span><\/span><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\">\u00a0<\/span><\/span><\/h5>\n<p><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\">Use <\/span><\/span><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\">the<\/span><\/span><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\">\u00a0following<\/span><\/span><span class=\"TextRun SCXW57311952 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57311952 BCX0\">\u00a0<code>CQL<\/code>:<\/span><\/span><\/p>\n<pre class=\"prettyprint\">CREATE KEYSPACE ordersapp WITH REPLICATION = {'class' : 'SimpleStrategy'}; \r\n\r\nCREATE TABLE ordersapp.orders ( \r\n    id uuid PRIMARY KEY, \r\n    amount int, \r\n    state text, \r\n    time timestamp \r\n);<\/pre>\n<h4 aria-level=\"2\"><\/h4>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Start the\u00a0application<\/span><span data-ccp-props=\"{&quot;335559738&quot;:40}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"none\">Open a terminal and s<\/span><span data-contrast=\"none\">et the<\/span><span data-contrast=\"none\">\u00a0environment variables\u00a0<\/span><span data-contrast=\"none\">for the application:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">export COSMOSDB_CASSANDRA_CONTACT_POINT=&lt;enter Cosmos DB account name&gt;.cassandra.cosmos.azure.com\u00a0\r\nexport COSMOSDB_CASSANDRA_PORT=10350\u00a0\r\nexport COSMOSDB_CASSANDRA_USER=&lt;enter Cosmos DB account name&gt;\u00a0\r\nexport COSMOSDB_CASSANDRA_PASSWORD=&lt;enter Cosmos DB access key&gt;\u00a0\r\n#optional (default: 5)\u00a0\r\n#export MAX_RETRIES=&lt;enter max number of retry attempts&gt;<\/pre>\n<p><span data-contrast=\"none\">To\u00a0start\u00a0the application:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">go run main.go\u00a0\r\n\r\n\/\/wait for this output\u00a0\r\nConnected to Azure Cosmos DB<\/pre>\n<p><span data-contrast=\"none\">To test whether the application is working as expected, insert<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">a few\u00a0<\/span><span data-contrast=\"none\">order<\/span><span data-contrast=\"none\">s\u00a0<\/span><span data-contrast=\"none\">by invoking the REST endpoint<\/span><span data-contrast=\"none\">\u00a0(once for each order) from a different terminal<\/span><span data-contrast=\"none\">:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">curl http:\/\/localhost:8080\/orders<\/pre>\n<p><div class=\"alert alert-primary\">The\u00a0application generates random\u00a0data\u00a0so you don&#8217;t have to enter it while invoking the\u00a0endpoint\u00a0<\/div><\/p>\n<p><span data-contrast=\"none\">Confirm that the order was successfully stored<\/span><span data-contrast=\"none\">.\u00a0<\/span><span data-contrast=\"none\">You can use the\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/cassandra-support#hosted-cql-shell-preview\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">hosted\u00a0<\/span><span data-contrast=\"none\">CQL shell in the Azure portal<\/span><\/a><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">and execute the below query:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">select count(*) from ordersapp.orders;\r\n\r\n\/\/ you should see this output\r\nsystem.count(*)\u00a0\r\n-----------------\u00a0\r\n\u00a0\u00a0\u00a0 1\u00a0\r\n(1 rows)<\/pre>\n<p><span data-contrast=\"none\">You&#8217;re all set<\/span><span data-contrast=\"none\">.<\/span><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Let the load tests begin!<\/span><\/h4>\n<p><span data-contrast=\"none\">I<\/span><span data-contrast=\"none\">nvoke the REST endpoint with\u00a0<\/span><span data-contrast=\"none\">3<\/span><span data-contrast=\"none\">00 requests. This is enough to overload the system since you only have 400 RU\/s allocated by default.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">To<\/span><span data-contrast=\"none\">\u00a0start<\/span><span data-contrast=\"none\">\u00a0the<\/span><span data-contrast=\"none\">\u00a0load test:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">hey -t 0 -n 300 http:\/\/localhost:8080\/orders<\/pre>\n<p><span class=\"TextRun SCXW263128501 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW263128501 BCX0\" data-ccp-parastyle=\"code-line\" data-ccp-parastyle-defn=\"{&quot;ObjectId&quot;:&quot;66502b49-d30f-41a1-8aeb-dd974c1203c5|222&quot;,&quot;Properties&quot;:[134233117,&quot;true&quot;,134233118,&quot;true&quot;,134233614,&quot;true&quot;,201340122,&quot;2&quot;,335559705,&quot;2057&quot;,469769226,&quot;Times New Roman&quot;,469775450,&quot;code-line&quot;,469777841,&quot;Times New Roman&quot;,469777842,&quot;Times New Roman&quot;,469777843,&quot;Times New Roman&quot;,469777844,&quot;Times New Roman&quot;,469778129,&quot;code-line&quot;,469778324,&quot;Normal&quot;],&quot;ClassId&quot;:1179649}\">Notice the logs in the application terminal. In the beginning, you will see that the orders are being successfully<\/span><\/span><span class=\"TextRun SCXW263128501 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW263128501 BCX0\" data-ccp-parastyle=\"code-line\">\u00a0created<\/span><\/span><span class=\"TextRun SCXW263128501 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW263128501 BCX0\" data-ccp-parastyle=\"code-line\">. For\u00a0<\/span><\/span><span class=\"TextRun SCXW263128501 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW263128501 BCX0\" data-ccp-parastyle=\"code-line\">example:<\/span><\/span><\/p>\n<pre class=\"prettyprint\">Added order ID 25a8cec1-e67a-11ea-9c17-7f242c2eeac0 \r\nAdded order ID 25a8f5ef-e67a-11ea-9c17-7f242c2eeac0 \r\nAdded order ID 25a8f5ea-e67a-11ea-9c17-7f242c2eeac0\r\n...<\/pre>\n<p><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">After a while, as the throughput degrades and eventually exceeds the provisioned limit, <\/span><\/span><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">A<\/span><\/span><span class=\"TextRun SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">zure<\/span><\/span><span class=\"TrackChangeTextInsertion TrackedChange SCXW221772253 BCX0\"><span class=\"TextRun SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">\u00a0<\/span><\/span><\/span><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">Cosmos DB will rate<\/span><\/span><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">limit the application requests. This will manifest itself in the form of an error which look<\/span><\/span><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">s<\/span><\/span><span class=\"TextRun Highlight SCXW221772253 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW221772253 BCX0\">\u00a0<\/span><span class=\"NormalTextRun AdvancedProofingIssueV2 CritiqueIndicatorHighlight SCXW221772253 BCX0\">similar to<\/span><span class=\"NormalTextRun SCXW221772253 BCX0\">\u00a0this:<\/span><\/span><span class=\"EOP SCXW221772253 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">Request rate is large: ActivityID=ac78fac3-5c36-4a20-8ad7-4b2d0768ffe4, RetryAfterMs=112, Additional details='Response status code does not indicate success: TooManyRequests (429); Substatus: 3200; ActivityId: ac78fac3-5c36-4a20-8ad7-4b2d0768ffe4; Reason: ({ \r\n  \"Errors\": [ \r\n    \"Request rate is large. More Request Units may be needed, so no changes were made. Please retry this request later. Learn more: http:\/\/aka.ms\/cosmosdb-error-429\" \r\n  ] \r\n});<\/pre>\n<p><div class=\"alert alert-success\">In the error message above, notice the\u202ffollowing: TooManyRequests (429)\u202fand\u202fRetryAfterMs=112 <\/div><\/p>\n<h5 aria-level=\"3\"><\/h5>\n<h5 aria-level=\"3\">Observing query errors<\/h5>\n<p aria-level=\"3\"><span data-contrast=\"none\">To keep things simple, we will use<\/span><span data-contrast=\"none\">\u00a0the log output\u00a0<\/span><span data-contrast=\"none\">for testing\/diagnostic purposes.<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">Any<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">error\u00a0<\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">related to<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">rate<\/span><span data-contrast=\"none\">&#8211;<\/span><span data-contrast=\"none\">limiting in\u00a0<\/span><span data-contrast=\"none\">this\u00a0<\/span><span data-contrast=\"none\">case<\/span><span data-contrast=\"none\">)<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">encountered\u00a0<\/span><span data-contrast=\"none\">during\u00a0<\/span><span data-contrast=\"none\">query execution<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">is intercepted by a<\/span><span data-contrast=\"none\">\u202f<\/span><a href=\"https:\/\/pkg.go.dev\/github.com\/gocql\/gocql?tab=doc#QueryObserver\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">gocql.<\/span><span data-contrast=\"none\">Query<\/span><span data-contrast=\"none\">Observer<\/span><\/a><span data-contrast=\"none\">.<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">T<\/span><span data-contrast=\"none\">he<\/span><span data-contrast=\"none\">\u00a0randomly generated order ID<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">is also logged with each error message\u00a0<\/span><span data-contrast=\"none\">so<\/span><span data-contrast=\"none\">\u00a0that you can\u00a0<\/span><span data-contrast=\"none\">check the logs to<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">confirm if the failed<\/span><span data-contrast=\"none\">\u00a0order\u00a0<\/span><span data-contrast=\"none\">has<\/span><span data-contrast=\"none\">\u00a0been\u00a0<\/span><span data-contrast=\"none\">re<\/span><span data-contrast=\"none\">&#8211;<\/span><span data-contrast=\"none\">tried<\/span><span data-contrast=\"none\">\u00a0and\u00a0<\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">eventually<\/span><span data-contrast=\"none\">)<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">stored in<\/span><span data-contrast=\"none\">\u00a0Azure<\/span><span data-contrast=\"none\">\u00a0Cosmos DB<\/span><span data-contrast=\"none\">.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">Here is the code snippet:<\/span><\/p>\n<pre class=\"prettyprint\">.... \r\ntype OrderInsertErrorLogger struct { \r\n   orderID string \r\n} \r\n\r\n\/\/ implements gocql.QueryObserver \r\nfunc (l OrderInsertErrorLogger) ObserveQuery(ctx context.Context, oq gocql.ObservedQuery) {\r\n  err := oq.Err \r\n  if err != nil { \r\n     log.Printf(\"Query error for order ID %s\\n%v\", l.orderID, err) \r\n  } \r\n} \r\n\r\n.... \r\n\r\n\/\/ the Observer is associated with each query \r\nrid, _ := uuid.GenerateUUID() \r\nerr := cs.Query(insertQuery).Bind(rid, rand.Intn(200)+50, fixedLocation, time.Now()).Observer(OrderInsertErrorLogger{orderID: rid}).Exec() \r\n....<\/pre>\n<h5 aria-level=\"3\">How\u00a0many orders\u00a0made\u00a0it through?<\/h5>\n<p><span data-contrast=\"none\">Switch back to the load testing terminal and check some of the statistics (output has been redacted for brevity)<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">Summary:\u00a0\r\n\r\n\u00a0 Total:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.8507 secs\u00a0\r\n\u00a0 Slowest:\u00a0\u00a0\u00a0\u00a0\u00a0 1.3437 secs\u00a0\r\n\u00a0 Fastest:\u00a0\u00a0\u00a0\u00a0\u00a0 0.2428 secs\u00a0\r\n\u00a0 Average:\u00a0\u00a0\u00a0\u00a0\u00a0 0.5389 secs\u00a0\r\n\u00a0 Requests\/sec: 70.1592\u00a0\r\n....\u00a0\r\n\r\nStatus code distribution:\u00a0\r\n\u00a0 [200]\u00a0300 responses<\/pre>\n<p><div class=\"alert alert-danger\">The numbers will differ in your specific case depending on multiple factors. <\/div><\/p>\n<p><span data-contrast=\"none\">This is not a raw benchmarking test and neither do we have a production grade app<\/span><span data-contrast=\"none\">lication<\/span><span data-contrast=\"none\">, so\u00a0<\/span><span data-contrast=\"none\">you<\/span><span data-contrast=\"none\"> can ignore the \u202f<\/span><code><span data-contrast=\"none\">Requests\/sec<\/span><\/code><span data-contrast=\"none\">\u202fetc. But draw our attention to the\u202f<\/span><code><span data-contrast=\"none\">Status code distribution<\/span><\/code><span data-contrast=\"none\">\u202f attribute <\/span><span data-contrast=\"none\">which<\/span><span data-contrast=\"none\">\u00a0shows that our application responded with a <code>HTTP<\/code> <\/span><code><span data-contrast=\"none\">200<\/span><\/code><span data-contrast=\"none\">\u202f for\u202f<\/span>all <span data-contrast=\"none\">the<\/span><span data-contrast=\"none\">\u00a0requests.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">Let&#8217;s confirm the final numbers. Open the\u202f<\/span><b><span data-contrast=\"none\">Cassandra Shell<\/span><\/b><span data-contrast=\"none\">\u202fin the Azure Cosmos DB portal and execute the same query<\/span><span data-contrast=\"none\">:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">select count(*) from ordersapp.orders; \r\n\r\n\/\/output\r\n\r\nsystem.count(*) \r\n----------------- \r\n    301<\/pre>\n<p><span data-contrast=\"none\">You should see\u00a0<\/span><span data-contrast=\"none\">3<\/span><span data-contrast=\"none\">00\u202f<\/span><i><span data-contrast=\"none\">additional<\/span><\/i><span data-contrast=\"none\">\u202f rows (orders) have been inserted. The key takeaway is that all the orders were successfully stored in <\/span><span data-contrast=\"none\">Azure\u00a0<\/span><span data-contrast=\"none\">Cosmos DB\u00a0<\/span><span data-contrast=\"none\">de<\/span><span data-contrast=\"none\">&#8211;<\/span><span data-contrast=\"none\">spite the rate limiting errors because our application code transparently retried them based on the Retry Policy that we configured (with a single line of code!)<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">clusterConfig.RetryPolicy\u00a0=\u00a0retry.NewCosmosRetryPolicy(numRetries)<\/pre>\n<h5>A note on dynamic throughput management<\/h5>\n<p><span data-contrast=\"none\">I<\/span><span data-contrast=\"none\">f\u00a0<\/span><span data-contrast=\"none\">your application\u00a0<\/span><span data-contrast=\"none\">spends\u00a0<\/span><span data-contrast=\"none\">most of its time operating\u00a0<\/span><span data-contrast=\"none\">at about 60-70% of\u00a0it\u2019s\u00a0throughput,\u00a0<\/span><span data-contrast=\"none\">using<\/span><span data-contrast=\"none\">\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/provision-throughput-autoscale\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">Autoscal<\/span><span data-contrast=\"none\">e\u00a0<\/span><span data-contrast=\"none\">provisioned throughput<\/span><\/a><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">can\u00a0<\/span><span data-contrast=\"none\">help<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">optimize your RU\/s and cost usage by scaling down when not in use<\/span><span data-contrast=\"none\">\u00a0&#8211; y<\/span><span data-contrast=\"none\">ou only pay for the resources that your workloads need on a per-hour basis.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">So, w<\/span><span data-contrast=\"none\">hat happens\u00a0<\/span><i><span data-contrast=\"none\">w<\/span><\/i><i><span data-contrast=\"none\">ithout<\/span><\/i><span data-contrast=\"none\">\u00a0the Retry Policy<\/span><span data-contrast=\"none\">?<\/span><\/p>\n<h5 aria-level=\"2\"><span data-contrast=\"none\">Deactivate\u00a0<\/span><span data-contrast=\"none\">the\u00a0<\/span><span data-contrast=\"none\">p<\/span><span data-contrast=\"none\">olicy<\/span><span data-contrast=\"none\">\u00a0to see the\u00a0difference<\/span><span data-ccp-props=\"{&quot;335559738&quot;:40}\">\u00a0<\/span><\/h5>\n<p><span data-contrast=\"none\">Stop the application (press <code>control+c<\/code>\u00a0 in the terminal)<\/span><span data-contrast=\"none\">, set\u00a0<\/span><span data-contrast=\"none\">an<\/span><span data-contrast=\"none\">\u00a0environment\u00a0<\/span><span data-contrast=\"none\">variable<\/span><span data-contrast=\"none\">\u00a0and re-start the\u00a0<\/span><span data-contrast=\"none\">application<\/span><span data-contrast=\"none\">:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">export USE_RETRY_POLICY=false\u00a0\r\ngo run\u00a0main.go<\/pre>\n<p><span data-contrast=\"none\">Before running the load test again<\/span><span data-contrast=\"none\">, make a n<\/span><span data-contrast=\"none\">ote\u00a0<\/span><span data-contrast=\"none\">of<\/span><span data-contrast=\"none\">\u00a0the\u00a0<\/span><span data-contrast=\"none\">number<\/span><span data-contrast=\"none\"> of rows in the orders table using \u202f<\/span><code><span data-contrast=\"none\">select\u00a0count(*) from\u00a0ordersapp.orders;<\/span><\/code><span data-ccp-props=\"{&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">hey -t 0 -n 300 http:\/\/localhost:8080\/orders<\/pre>\n<p><span data-contrast=\"none\">In the application logs, you will notice the same rate limiting errors. In the terminal where you ran the load test, at the end of the output summary, you will see that some the requests failed to complete successfully i.e. they returned a response other than <code>HTTP 200<\/code><\/span><\/p>\n<pre class=\"prettyprint\">...\r\nStatus code distribution:\u00a0\r\n\u00a0 [200]\u00a0240 responses\u00a0\r\n\u00a0 [429] 60 responses<\/pre>\n<p><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">Because<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">the Retry Policy<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">was<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">\u00a0no<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">t\u00a0<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">enforced<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">,\u00a0<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">the<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">\u00a0application no longer re<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">&#8211;<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">tried the requests that failed due to rate-limit<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">ing<\/span><\/span><span class=\"TextRun Highlight SCXW27459096 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW27459096 BCX0\">.<\/span><\/span><span class=\"EOP SCXW27459096 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h5>Increase\u00a0provisioned throughput<\/h5>\n<p><span data-contrast=\"none\">You can increase the Request Units using the Azure Portal (for\u00a0<\/span><span data-contrast=\"none\">example,<\/span><span data-contrast=\"none\">\u00a0double it to\u202f<\/span><code><span data-contrast=\"none\">800<\/span><\/code><span data-contrast=\"none\"> <code>\u202fRU\/s<\/code>) and run the same load\u00a0test<\/span><\/p>\n<p><img decoding=\"async\" class=\" wp-image-1624 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/increase-ru-300x79.png\" alt=\"Image increase ru\" width=\"665\" height=\"175\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/increase-ru-300x79.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/increase-ru-1024x269.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/increase-ru-768x202.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/increase-ru-1536x404.png 1536w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/09\/increase-ru.png 2048w\" sizes=\"(max-width: 665px) 100vw, 665px\" \/><\/p>\n<pre class=\"prettyprint\">hey -t 0 -n 300 http:\/\/localhost:8080\/orders<\/pre>\n<p><span data-contrast=\"none\">You will\u202f<\/span><b><span data-contrast=\"none\">not<\/span><\/b><span data-contrast=\"none\">\u202fsee the rate limiting (<code>HTTP <\/code><\/span><code><span data-contrast=\"none\">429<\/span><\/code><span data-contrast=\"none\">) errors now and relatively low numbers for latency, requests per second etc.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;335559738&quot;:180}\">\u00a0<\/span><\/p>\n<p><div class=\"alert alert-success\">Try increasing the number\u00a0of requests (using\u202f-n\u202fflag) to see when the throughput threshold is breached for the application to get rate\u00a0limited\u00a0<\/div><\/p>\n<p><span data-contrast=\"none\">As expected, all the orders will be persisted successfully<\/span><span data-contrast=\"none\">\u00a0(without any errors or retries)<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">The next section briefly covers\u00a0<\/span><span data-contrast=\"none\">how the <a href=\"https:\/\/github.com\/abhirockzz\/cosmos-cassandra-go-extension\" target=\"_blank\" rel=\"noopener noreferrer\">custom Retry Policy<\/a> works<\/span><span data-contrast=\"none\">.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><div class=\"alert alert-warning\">This is an experimental implementation, and you should write custom policies to suit fault-tolerance and performance requirements of your applications. <\/div><\/p>\n<h3><span class=\"TextRun MacChromeBold SCXW210674861 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW210674861 BCX0\">Behind the scenes<\/span><\/span><\/h3>\n<p><span data-ccp-props=\"{}\"><code><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SpellingErrorHighlight SCXW202374152 BCX0\">CosmosRetryPolicy<\/span><\/span><\/code><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">adheres to the\u00a0<\/span><\/span><a href=\"https:\/\/pkg.go.dev\/github.com\/gocql\/gocql?tab=doc#RetryPolicy\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW202374152 BCX0\">g<\/span><\/span><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW202374152 BCX0\">o<\/span><\/span><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW202374152 BCX0\">cql.RetryPolicy<\/span><\/span><\/a><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">interface\u00a0<\/span><\/span><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">by implementing<\/span><\/span><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">\u00a0the\u00a0<\/span><\/span><code><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">Attempt<\/span><\/span><\/code><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\">\u00a0and\u00a0<\/span><\/span><code><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW202374152 BCX0\">GetRetry<\/span><\/span><\/code><span class=\"TextRun SCXW202374152 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW202374152 BCX0\"> functions.<\/span><\/span><\/span><\/p>\n<pre class=\"prettyprint\">type CosmosRetryPolicy struct { \r\n    MaxRetryCount         int \r\n    FixedBackOffTimeMs    int \r\n    GrowingBackOffTimeMs  int \r\n    numAttempts           int \r\n}<\/pre>\n<p><span data-contrast=\"none\">Retry is initiated<\/span><span data-contrast=\"none\">\u00a0only if\u00a0<\/span><span data-contrast=\"none\">the number of retry<\/span><span data-contrast=\"none\">\u00a0attempts\u00a0<\/span><span data-contrast=\"none\">for that query\u00a0<\/span><span data-contrast=\"none\">are less than or equal to max retry config or max retry config is set to -1 (infinite retries)<\/span><\/p>\n<pre class=\"prettyprint\">func\u00a0(crp\u00a0*CosmosRetryPolicy)\u00a0Attempt(rq\u00a0gocql.RetryableQuery)\u00a0bool\u00a0{\u00a0\r\n    crp.numAttempts\u00a0=\u00a0rq.Attempts()\u00a0\r\n    return\u00a0rq.Attempts() &lt;=\u00a0crp.MaxRetryCount\u00a0||\u00a0crp.MaxRetryCount\u00a0==\u00a0-1\r\n}<\/pre>\n<p><code><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW229241959 BCX0\">GetRetryType<\/span><\/span><\/code><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">function\u00a0<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">detects the type of error and in the case or a rate-limited error (<code>HTTP 429<\/code>), it tries to extract the value for <\/span><\/span><code><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SpellingErrorV2 SCXW229241959 BCX0\">RetryAfterMs<\/span><\/span><\/code><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">\u00a0field (from the error message) and use<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">s<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">\u00a0that to sleep\u00a0<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">before<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">\u00a0retrying the\u00a0<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">query<\/span><\/span><span class=\"TextRun SCXW229241959 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW229241959 BCX0\">.<\/span><\/span><span class=\"EOP SCXW229241959 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint\">func (crp *CosmosRetryPolicy) GetRetryType(err error) gocql.RetryType {\r\n\r\n   switch err.(type) { \r\n   default: \r\n         retryAfterMs := crp.getRetryAfterMs(err.Error()) \r\n         if retryAfterMs == -1 { \r\n             return gocql.Rethrow \r\n         } \r\n        time.Sleep(retryAfterMs) \r\n        return gocql.Retry \r\n\r\n\/\/other case statements have been omitted for brevity \r\n}<\/pre>\n<p><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun CommentStart SCXW101051521 BCX0\">Azure\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">Cosmos DB provides you the flexibility to not only configure and adjust your throughput requirements\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">using a variety of ways but also\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">provides<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0the basic primitive that\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">allows applications to handl<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">e<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0rate limiting errors, thereby making them\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">robust<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0and<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0fault-toleran<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">t<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">. This blog post\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">demonstrated<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0how you can do this for Go applications, but the concepts\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">are applicable<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0to any<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0language and its respective<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0<\/span><\/span><a class=\"Hyperlink SCXW101051521 BCX0\" href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/cassandra-support#cassandra-protocol\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\" data-ccp-charstyle=\"Hyperlink\">CQL compatible<\/span><\/span><\/a><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0driver that you choose<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW101051521 BCX0\">for<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW101051521 BCX0\">working<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">\u00a0with the Cassandra API for\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">Azure\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW101051521 BCX0\">Cosmos\u00a0<\/span><\/span><span class=\"TextRun SCXW101051521 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"none\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW101051521 BCX0\">DB.<\/span><\/span><\/p>\n<h5><b><span data-contrast=\"none\">To l<\/span><\/b><b><span data-contrast=\"none\">earn more:<\/span><\/b><\/h5>\n<p><span data-contrast=\"none\">Check out<\/span><span data-contrast=\"none\">\u00a0some of these resources from the official documentation:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/cosmos-db\/provision-throughput-autoscale#benefits-of-autoscale\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">Use cases and benefits of Autoscale provisioned throughput<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"none\">Details of the\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/cassandra-support\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">Cassandra API support<\/span><\/a><span data-contrast=\"none\">\u00a0in\u00a0Azure\u00a0<\/span><span data-contrast=\"none\">Cosmos<\/span><span data-contrast=\"none\">\u00a0DB<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/create-cassandra-go\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">Get up and running with a Go application and Cassandra API for Azure Co<\/span><span data-contrast=\"none\">s<\/span><span data-contrast=\"none\">mos DB<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/create-cassandra-go\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">Frequently asked questions about the Cassandra API in Azure Cosmos DB<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/cosmos-db\/request-units\" target=\"_blank\" rel=\"noopener noreferrer\"><span data-contrast=\"none\">Request Units concepts<\/span><\/a><span data-contrast=\"none\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Step-by-step guidance about how to build fault tolerant applications using the Azure Cosmos DB Cassandra API with a custom retry policy for 429 errors.<\/p>\n","protected":false},"author":38710,"featured_media":1094,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16],"tags":[1079,740,1076,1738,1080],"class_list":["post-1615","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cassandra-api","tag-apache-cassandra","tag-appdev","tag-cassandra","tag-go","tag-paas"],"acf":[],"blog_post_summary":"<p>Step-by-step guidance about how to build fault tolerant applications using the Azure Cosmos DB Cassandra API with a custom retry policy for 429 errors.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/1615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/38710"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=1615"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/1615\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/1094"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=1615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=1615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=1615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}