Overview of Cosmos DB on Azure Government
Hi. This, is Steve McCatty from the azure government. Engineering, team I'm joined. Here today by Rifat, Soroush from, the cosmos DB engineering, team and we are going to be discussing, cosmos, DB on Azure government, welcome, thank, you so I think the most, logical way for us to start is to just start, by describing what is cosmos. DB okay, so, cosmos, DB is a multi. Model multi, master globally. Distributed database. So that's a mouthful I think we'll explain this as we go sure but, before we talk about cosmos, DB I would like to talk about what. Problem, we, are trying to solve here okay right because technology, for technology's, sake you know it'd be fun so, if. We, see what, are the challenges modern. Apps faces. Today number. One is all these apps today because, the word is flat they, have, to have a global distribution data. Is created in one region consumed, in another region so. I so. As you go may not be internationally. Distributed, but. You have, u.s.. East and us West so data can easily be consumed, from different region so cosmos, DP is a globally, distributed database. On Azure, on edge in Azure government, of course it's nationally distributed so, right yeah good point and and second is we see that, we. Have to have very you know high responsiveness. And. Most. Of the modern apps have personalization, and because, they have to have personalization, by that I mean the app need to know you so, they can tailor. Made their menu and options for you everyone, has user preferences, that kind of thing things like that right lot of data lot, of data and to because. If you, want to enable the personalization, feature, on your app you have to go through the history of your usage. Of your data so, lot of data you have to process. And this. Data can, be you know very complex, and different schema, and things like that, and. Because. That apps are globally distributed your. Users, are distributed, so you really, it's, very difficult, for you to figure it out what is the requirement for your storage and throughput from, the get-go we might want our app there are data to be as close as possible to our users as, to your users - right okay and, so. And then, today's. If, any app takes, more than 200, or 300, milliseconds, we said that app is slow and and you user complain so we have this requirement that we. Have to have very low latency even, if the data is distributed we have to have a low latency for our global users, and I think this is an interesting point because a lot, of the crusty, old sequel people will think oh I have Oracle sequel server sometimes, these queries take a long time so do. We really have low latency on cosmos sometimes seeing, is believing true true, true and, as as I am showing here that all this modernizing. App have to have personalization. Recommendation.
Can See that, when you write the data the. Data is written to fork, in. Data, is written full copies, of data is written in, a data center itself so, as you can see in the slide that, you. Have a collection, and I have there's three partitions. And. Your. Data is written full copies of it and what. We mean by always on that. If there's, a problem there's. A problem on the, partition. You. Will feel. Nobly. There. Will be no. Hiccups, on your application, your application, will keep working. Because. I still have three copies I can have the quorum and then. Your. Application. Will keep working when the desk will be repaired behind, the scene the data will be distributed, you will know nothing so if I look at this diagram here I see us cover jigna, that's my primary writable. Region right I've got Texas, and Arizona those, are my secondary. Read, location, right and you're saying even if we have one of the partitions. On Virginia, I'm, still not as if we get a blip yes because it'll, be prepared in the background it will be located in the background and and the applications, will keep working and as we shown. Here that you can write in one region and read it from all different region, okay now if there's. A problem and. Hole. Of the partition, is gone even. Then you there, will be no effect to the user and that's. Why we call it always on, because. Now. The, all will flip automatically. To the. Taxes. Okay. Data, center, and, then, and, this all you control, I'll, show you on the portal how, you distribute, this data and how you control, that what should be my preference which data center I should flip to when, there's a problem correct, and in the worst case, if. We say that whole, data center is gone away even. Then your user may just feel a hundred. Millisecond. 150, millisecond, delay but. The application, will keep working so. There's that's. The beauty of this, Drupal. Distribution thing. So in this case then Texas, for example might switch, to be my primary data, data, center region, yes okay and and. No matter what happens, your. Applications, will keep working data it's I'm, saved I'm just trying to think as an engineer, the engineering, feat that I would have to do if I wanted to do something like this on Prem myself, oh my god I don't think I want any part of it sure okay, so Microsoft is doing this for me yeah exactly and now, let me show you on the portal okay great so as you can see in this screen that we, are on the portal looking, at the cosmos DB and, I, already. Have two collection, we'll go in to tell how to create this collection later on but, I want to quickly show you how you.
Can Replicate this, data globally. So today here I'm just showing you four. Data center because it's as. Your goal but, if you are outside, of the government you will have options, all around, the world like 52 data centers but this is a good picture, actually because it shows us yes you are in Azure government, here are the azure government, regions where we have cosmos exactly, and as you can see when, you take your mouse it shows you the name and, Texas. And here, it is u.s.. DoD central, and, Arizona. And just, to, distribute, this you, just go ahead and click, on this data center and that's it it's. Unbelievably. Simple. That. You can distribute your data but just, by a click of the mouse yes I see at the bottom it says Texas, as the right region but you click Arizona, and now all sudden Arizona is showing us a read region as a region, that's true and then you can just go and save and that's, it okay nothing no more configuration. Is needed nothing, you have to do free and if you see if I'll just discard. It quickly so I can see this other menus lighter that, I have an automatic failover, by. That, we, mean is. If. Your application, is running and there's a problem in the data center automatically. The, application, will move to the next data center again nothing, is needed from your end to, enable this thing and then, we have the manual failover, where, you want, to do a test and you want to say how, this, failover takes place then, you can use this option to, manually failover, so, if I don't trust the automatic, failover I can always test it and you can all myself some peace of mind there right ok great ok so. That's. One. Thing the next thing I want to show you here. Again, we. Differentiate, ourselves from the competition. The consistency, level if, you see, no. Sequel, a market. And all the products, which we have in the market they, generally have two consistencies. They, have strong, consistency, or eventual, consistency and, you have to choose one of them and the beauty of this what, cosmos, DB has done comes. More in focus, when you start developing, an application and, later on you realize for. This consistency. Level is not good enough I want, to change here, you have an auction, that you can change this consistency, level too so. As you. Can see there's just this, five radio. Buttons are there and you can just click on them and you can choose, one. Of the consistency, level so, let me quickly explain what, do I mean by all, these different consistency, level strong. Consistency, means when. Many. To strong consistency, by, that it means when you get the ACK back, from your right, you. Should be rest assured that your data is strongly. Consistently. Written, on the data on the on the desk so no still reads that no still reads, and. You, don't have to worry about that if you will lose the data it's really written, the data right so that's strong consistency, now. We. Do have a strong, consistency, in multi. Multi-regional, strong, consistencies also there which. Is in preview but very soon we will be enabling so, you can have, saying. If I write in us best, I want, it consistently. Written, in us is that's also an option okay. Second. Is bounded, stillness where. You. Say that I am fine to have my data steal, by, few, minutes. Or seconds, and for some applications, that's perfectly appropriate yes, because. What happened if you say I want strong, in multi region you have to pay the price of the roundtrip, so it will cost you 200, or 150. Milliseconds. For. The roundtrip, but, you don't want to pay that price but you still want the data consistently, written in different region so, then you will use bounded, stillness and. Next. One is the session session is very simple, like, whatever, you. Write that's all you're going to read so it's it's bounded, to your session, and next. One is consistent. Prefix, by. Consistent, prefix we mean that you will see the data on the other side in, the same sequence that data is written so, if I have written a B, and C on the, other side also you will see a B, and C and this. Comes this, becomes very important, if. You are writing a, chat. Application where, people are chatting so. If you, have consistent prefix, set by. That you guarantee, that you will never see a an, answer. Before the question okay, right that's consistent, prefixes, and eventually, is eventual that eventually that, data will be consistent, but if everything, is okay like, there's no a breakage, in the network pipe and all again.
This Eventual, consistency also, works with the almost, speed of light in few second, milliseconds you will have the data on the other end so those are really clear, explanations, and I noticed not only that but you can click on any one of these and the portal, will actually show you the exactly brief description, of what each of those are so that's very cool right so let, me show you how. You can write code to use. Cosmos DB so, this is I'm showing you a c-sharp. Code. Here and first, thing is obviously you have to go and. Get. To our client, libraries once. You access the crap when, once you reference, the client library code, is very simple in just couple of line there's. A lot of code here but I am just zooming. In to, the main, code. Which is, creating. The client library, and then how we will use it how we will use, the, client library to insert some data for it so if, you see we. Just knew up a document client, library and for, that we just need three things what. Is the end point what is the auth key and the connection policies, right, just three things let's, look at each of them one, after another so. If, I show you my app config. Here I just defined, my. Four, things. What. Is my end point this is you will get from the portal and we see that that has it documents. That Azure da us, so that's our government. As opposed to Azure commercial, exactly, exactly, and then this is your auth key and then, you just put your database, name and collection, there and if. You see the code back here. That's. What I'm doing, using. The endpoint and auth key and connection, so if I look at this line of code here on line 160, it's actually the exact, same line of code that I would do an azure commercial, I do an azure government, yeahhow code changes for a developer it's just that one connection, difference, and that's it only change roger government, true true exactly, the, same code is running between, go and in public, clouds so there's no change, so. Now once the client is created, what, you will do is. Here's. Just one line of code where you say create. Document. Asing and then, you give that collection uri, and i, will show you what his collection, uri and the data so when we create document, we're really basically, saying insert, a record inserted. Okay right exactly, so this data is defined as, as a IOT, data class and. It. Is anything we want it is it can be anything and it's plain vanilla, you. Know just see shop class where you are just defining all these properties on it once. You define that you. Can use, with. The collection, URI and, what is collection URI it's nothing, but you know and the collection so let me show you.