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.
Social. Gamification. All these, are mimbar. For the apps there's no more a premium, feature right so we. Were in Microsoft, we were seeing this problem. Almost. About an 80 years back or so when, we were building, when. We were trying to build database, for our own need for Xbox. And Skype where we have this you. Know hugely. Globally. Distributed. Customer. Base. And. So, we started. Building this database called cosmos DB and it's born into loud so, from. From. The inception of, our. Design. Principles where, that we have to have global distribution, elastic. Scale out and guaranteed. Low latency, so, that's how we build, this core capability. Platform, and then, on top, of this we build multi. Module so, by multi model I mean any Enterprise, have data, in different forms, and. They. Would like to consume, this, data. In different forms, not. Only through UI but, the, client libraries, itself, so, on. This core, you. Know capability, platform, we build this multi model database. Where you can keep different. Kind of data you can keep a document, data you, can keep graph data. Call. Family, or tacky value so I think this is a really important, point because I, think, often, misunderstood, with cosmos because a lot of times people think cosmos, DB okay that's a no sequel document, database and it is but. You have these other options too if you want to use that column great key, value great, I mean graph storage, it can do all of that you get to be in control exactly. And if you, will see our competition you. Have to have different database, products, to, keep a graph database keep, a you know JSON. Documents, or, column. Family here. In cosmos DB everything, is in one database so you don't have to learn four. Different, databases different, technologies, and you know in languages, and client libraries are not it's, all into, one right and, on top of this. We. Have different, client libraries to interact, with this multi, modal databases, we, have our own secret client libraries, to deal with. Documents. And, they are in different languages c-sharp, Java, Python JavaScript. And. For. Cassandra and Mongo, you can use their. Libraries, itself, so you don't have to learn anything new if. You are a Mongo user and you bought the Mongo data in cosmos, DB you, don't have to learn anything new so, you tell me if I'm a developer that currently uses MongoDB, I don't. Even have to use any of these as your client libraries I can use my existing Mongo, API exactly. Point my connection at cosmos. Right, and all. Of a sudden now I have if. I'm an azure government, national, geo, redundancy. And multiple, regions exactly. I didn't have to change any code as a developer, no code change you have to just change the connection string we. Have many demos. On. The web where, we showed this that you use, Mongo, tools Mongo, export Mongo, import and move, that Mongo data into the cosmos DB change the, connection string and, your application, will keyboard okay cool so I've heard you talk about geo, distribution, a little bit and geo redundancy, can you give, us a little bit more information on that topic so so. When. I say your, data is globally, distributed. You. Know that as your data centers, are almost. I think in 50 or 50 two places we have a, Geo, data center and cosmos, DB is a ring 0 service by that we mean wherever, as you'll is, cosmos. DB will be so. Your. Data you can distribute, to all this 52 data centers, and they are growing every, day or enhancer government the six data centers we have cosmos, TV is there as well to true and and, with that. You. Have this option to manually, or automatically, you can failover, from, one region to another region so, let me explain that through a couple. Of slides which, will which will make it understand, you know which. Will make you understand, it very simply okay so. As you.
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.
I Can, almost conceptually. Think of it like a table name sort of exactly. Okay exactly. This. Is what how I create, my collection, URI right I am, saying, URI Factory give him database, and collection, okay right it's exactly, like database, name and then the table so, one. Line of code to create that line one, line of code to insert the data also that these are the two lines so now let's see let's run, this code again and here you. Know this, code is just creating, the database if it's not there and as you can see once. You have the client client library, you just say create database, and it creates it so I can create a database from the portal if I want or I can create a database program my, door if I want see shop and. These client libraries I'm, showing you in C shop but you can use JavaScript. Java. Python, or any other language here, all right let's run it so let's run it and see, so. Before. I run it let's go to portal, and see it's empty here. This. Is my database, and this is my collection. Now. Let. Me run this. So. It looks like this is inserting, so have all records, this is inserting, multiple records, and, now let's. Go to the portal and see if, I find this there. It is document, that's, inserted. All. Right so pretty easy to do very easy to do that and as you can see your. Documents. Are showing, up here I didn't have to create schemas, or alter, table statements, or anything like that I just had a some c-sharp room, insert and. As you know that it's an or sequel so it's schema, agnostic, you, can keep inserting the document. With different schema okay so and and everything will work great, well this has been a great introduction. To cosmos to DP on Azure government we've talked about geo. Distribution. I've, talked about multi model different. Staleness. Levels, that are supported with consistency, and we've even seen the portal as well as c-sharp example so great, introduction thank you thank you this has been Steve McCatty of azure government, engineering, with Rifat sarosh of the cosmos DB engineering, talking about cosmos, DB on Azure government. Thanks for watching.
2018-09-15