{"id":14445,"date":"2020-03-31T15:40:31","date_gmt":"2020-03-31T14:40:31","guid":{"rendered":"https:\/\/www.microsoft.com\/en-gb\/industry\/blog\/?p=14445"},"modified":"2020-03-31T15:41:33","modified_gmt":"2020-03-31T14:41:33","slug":"azure-cosmos-db-a-completely-unofficial-primer","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-gb\/industry\/blog\/technetuk\/2020\/03\/31\/azure-cosmos-db-a-completely-unofficial-primer\/","title":{"rendered":"Azure Cosmos DB: A Completely Unofficial Primer"},"content":{"rendered":"
<\/p>\n
Azure Cosmos DB – a service that is growing at a phenomenal rate as developers and data scientists across the world start taking advantage of its remarkable capabilities. As in my previous blogs, please accept the usual caveats i.e. be aware that I have over-simplified somewhat and that you should read the official documentation for the full and totally accurate picture.<\/p>\n
With that out of the way let\u2019s cut to the chase: Cosmos DB is, as the name suggests, a database and it resides within the Azure cloud. But it\u2019s a database with a difference. In this article I\u2019m going to focus on just two significant benefits of Cosmos DB:<\/p>\n
<\/p>\n
Before we get into \u201cNo SQL\u201d we should ask: What is \u201cSQL\u201d? It stands for \u201cStructured Query Language\u201d which is a fairly gross misnomer given that arguably it\u2019s not particularly structured, is about more than just queries, and isn\u2019t really a language. But let\u2019s not get bogged down with poor nomenclature. SQL has been used for many years as\u00a0the<\/em>\u00a0way to interact with data \u2013 I spent much of my youth as a developer building applications that used Microsoft SQL Server and it works very well. You can use SQL Server to define the\u00a0schema\u00a0<\/em>– a sort of blue-print of the structure of the information you need to store and access – and the commands themselves that you use to access it. The problem is that while SQL is useful in many situations it isn\u2019t always the best way to either store the data or access it.<\/p>\n Let me give you an example: If you\u2019re storing documents you may find that each one might contain completely different data and you may need to change its structure on the fly. SQL is fairly poor at doing this \u2013 it likes a nice, ordered world where data structures don\u2019t change very often and everything can conform to a template.<\/p>\n For this reason Cosmos DB provides a number of different ways to store and access data, it isn\u2019t just restricted to the \u201cSQL way\u201d of doing things. For sure, it has the concept of a key-value pair which is similar in many ways to how SQL works but it goes well beyond this, having document stores (which address the issue mentioned above) as well as others such graph stores that focus on relationships (great for social-media type data for example), column stores that store data in columns rather than rows which massively increases read speeds for certain types of data, and so on.<\/p>\n The other amazing feature is that Cosmos DB indexes all of your data automatically, no matter which data model you\u2019re using. Indexes equate to blisteringly-fast data access so this is a big deal.<\/p>\n So while it\u2019s called \u201cNo SQL\u201d it\u2019s actually much more than SQL: It stores and provides access to data with super-efficiency due to its flexible nature, no need for schemas, and automatic indexing taking it well beyond what we think of as \u201cSQL\u201d.<\/p>\n <\/p>\n In case you hadn\u2019t noticed, the world has changed a bit in the last few years. These days people (and I absolutely include myself in this) expect\u2026well, they expect far too much. By which I mean, and I\u2019ll use myself as an example, I expect to be able to use my phone anywhere in the world and get instant access to everything. I would be furious if I found that, simply because I\u2019m on the other side of the planet, my apps are slow and it takes ages to get at data or update things. Such is the height of the expectation bar these days. And of course the problem is worse for business that need to process masses of data.<\/p>\n Now if you\u2019re a developer or data architect this is a problem. The challenge, you see, is the speed of light. No really. The speed of light. As you may know if you remember your school physics the speed of light is a cosmic speed limit \u2013 nothing can travel faster than the speed of light. This isn\u2019t a physical limitation that we haven\u2019t figured out how to crack yet, it\u2019s a part of the actual structure of the universe. And that includes the data sloshing around your network and the internet. Now, you might think that light travels pretty fast which it does \u2013 196,000 miles per second. But even those monstrous speeds can cause a problem if your data resides on the other side of the planet. In short, there will be a very noticeable delay compared to the access times you would experience if your data were, say, just a few miles away.<\/p>\n So what\u2019s the answer? There\u2019s only one way to address this (unless you\u2019re able to change the structure of the universe): Have copies of your data dotted around the planet so that wherever you are you\u2019re never far from a copy. And hey presto, you have fast access wherever you are.<\/p>\n However as is so often the case the answer to one question causes new questions to arise. Or in this case, new problems. The first one is quite obvious \u2013 storing your data in locations around the planet is far from trivial and likely to be insanely expensive. Microsoft Azure has data centres in regions across the planet and so addresses this issue. Then there\u2019s the second problem, how on earth do you keep everything in sync so that everyone sees and uses the same version of the data, even though there are multiple copies of it? Fortunately some extremely brainy data scientists have spent a lot of time thinking about this and much of the fruits of their labour are built into Cosmos DB. Without getting into details (although there\u2019s lots of information\u00a0here<\/u><\/a>\u00a0if you want to know more) Cosmos DB is able to balance the need for speed of access with the need for data consistency in a number of clever ways so that you don\u2019t need to worry about it.<\/p>\n <\/p>\n I\u2019ve only really scratched the surface in this article. There is lots more to Cosmos DB – for example it would be remiss of me not to mention that Cosmos DB offers a money-back guarantee via comprehensive\u00a0Service Level Agreements<\/u><\/a>. Or the multiple APIs for accessing it. Or the incredible uptime and low-latency guarantees. Plus it\u2019s in the cloud so has almost limitless capacity. And lots more.<\/p>\n All of which adds up to an incredibly powerful, flexible and global-scale way of storing and accessing data. Start learning more\u00a0here<\/u><\/a>. Or\u00a0try it for free<\/u><\/a> (for a limited time).<\/p>\n <\/p>\n Ian Moulster is back with a totally unofficial look at Microsoft Azure Cosmos DB, a service that is growing at a phenomenal rate as developers and data scientists across the world start taking advantage of its remarkable capabilities.<\/p>\n","protected":false},"author":430,"featured_media":31584,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ms_queue_force_push":false,"ms_queue_id":"","ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","footnotes":""},"categories":[594],"post_tag":[128,519],"content-type":[],"coauthors":[708],"class_list":["post-14445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technetuk","tag-azure","tag-technet-uk"],"yoast_head":"\nOk, so what about this global availability thing?<\/h2>\n
Summary<\/h2>\n
Resources<\/h2>\n
\n