{"id":24725,"date":"2021-04-07T10:15:08","date_gmt":"2021-04-07T17:15:08","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/aspnet\/?p=24725"},"modified":"2021-10-29T03:23:03","modified_gmt":"2021-10-29T10:23:03","slug":"your-top-dotnet-microservices-questions-answered","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/your-top-dotnet-microservices-questions-answered\/","title":{"rendered":"Your Top .NET Microservices Questions Answered"},"content":{"rendered":"<p>In our recent <a href=\"https:\/\/aka.ms\/letslearndotnet\" target=\"_blank\" rel=\"noopener\">Let&#8217;s Learn .NET<\/a> event focused on getting started with microservices we received some great questions from you. We were able to answer many questions live, but we wanted to follow up and answer some of the most popular that came up during the session. If you missed the live event, don&#8217;t worry because you can watch it on-demand.<\/p>\n<p><iframe width=\"800\" height=\"450\" src=\"https:\/\/www.youtube-nocookie.com\/embed\/sstOXCQ-EG0\" allowfullscreen><\/iframe><\/p>\n<p>Watch on <a href=\"https:\/\/channel9.msdn.com\/Shows\/lets-learn-dotnet\/Lets-Learn-DotNet-Microservices\" target=\"_blank\" rel=\"noopener\">Channel 9<\/a><\/p>\n<h3>When we scale the services, how can we scale databases related to those services?<\/h3>\n<p>There are well-defined patterns and best practices for improving performance and scaling databases. Refer to\u00a0<a href=\"https:\/\/docs.microsoft.com\/azure\/architecture\/best-practices\/data-partitioning?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">Horizontal, vertical, and functional data partitioning<\/a>\u00a0to understand how data is divided into partitions to improve scalability, reduce contention, and optimize performance. To go deep-dive into Scaling microservices, Distributed data, why database-per-microservice, choosing between Relational vs NoSQL databases, refer to our guidance on\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/architecture\/cloud-native\/distributed-data?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">Architecting Cloud-Native .NET Apps for Azure<\/a>\u00a0or download the\u00a0<a href=\"https:\/\/dotnet.microsoft.com\/learn\/azure\/architecture#ebook-cloud-native-azure-swimlane?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">free e-Book<\/a>.<\/p>\n<h3>Do we need to use a new Database for each microservice, or can the microservices share the same Database instance?<\/h3>\n<p>Autonomy for teams to work with their microservices is a crucial benefit of architecting cloud-native apps. It is preferred to use independent database instances to give the teams the flexibility to roll out updates, security patches, bug fixes in production without breaking other microservices. Cloud-Native app architecture takes inspiration from the famous\u00a0<a href=\"https:\/\/12factor.net\/\" target=\"_blank\" rel=\"noopener\">12-factor app methodologies<\/a>. One factor, &#8220;Backing Services,&#8221; states that the\u00a0<em>Ancillary resources like the data stores, caches, message brokers should be exposed via an addressable URL.\u00a0<\/em>Cloud providers offer a rich assortment of\u00a0<em>managed backing services.<\/em>\u00a0Instead of owning and maintaining the database yourself, we recommend checking out the\u00a0<a href=\"https:\/\/docs.microsoft.com\/dotnet\/architecture\/cloud-native\/relational-vs-nosql-data?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">available database options<\/a>\u00a0in the cloud.<\/p>\n<h3>Can a monolithic Web API talk with microservices?<\/h3>\n<p>Yes. Monolithic apps can talk with microservices if their endpoints are reachable within the infrastructure or securely using a public endpoint. Microservices and their data can either be consumed synchronously via their endpoints or asynchronously through messaging like the Event Bus. As part of modernizing techniques, we recommend the\u00a0<a href=\"https:\/\/docs.microsoft.com\/azure\/architecture\/patterns\/strangler-fig?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">strangler pattern<\/a>, which helps in incrementally migrating a legacy system. As part of the solution, you need to create a fa\u00e7ade that intercepts requests. The fa\u00e7ade routes these requests either to the legacy application or the new services. To learn more about Microservices communication and modernizing techniques, refer to the\u00a0<a href=\"https:\/\/dotnet.microsoft.com\/learn\/aspnet\/microservices-architecture?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">.NET Architecture Guidance<\/a>.<\/p>\n<h3>If microservices are loosely coupled and deployed independently, how do they communicate with each other? How do you synchronize data between microservices?<\/h3>\n<p>This is a great question. The answer is explained in detail in two sections of the book\u00a0<a href=\"https:\/\/docs.microsoft.com\/dotnet\/architecture\/cloud-native?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">Architecting Cloud-Native .NET Apps for Azure<\/a>. These links will help you:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/architecture\/cloud-native\/communication-patterns?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">Cloud-Native Communication Patterns<\/a>\u00a0or download the\u00a0<a href=\"https:\/\/dotnet.microsoft.com\/learn\/azure\/architecture#ebook-cloud-native-azure-swimlane?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">free e-Book<\/a>.<\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/dotnet\/architecture\/cloud-native\/distributed-data?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">Managing data in Distributed Apps<\/a><\/li>\n<li>You can also download the\u00a0<a href=\"http:\/\/aka.ms\/ebook-microservices-architecture\" target=\"_blank\" rel=\"noopener\">free e-Book<\/a>\u00a0on Microservices architecture guidance which covers some patterns like DDD, CQRS, Event sourcing etc.<\/li>\n<\/ul>\n<h3>Do microservices need to use containers?<\/h3>\n<p>Not necessary. However, using containers has its benefits. Microservices, generally known as Microservices Architecture, are design guidance and best practices. It helps you decompose your application into multiple smaller services defined by specific business boundaries that are independently managed by smaller teams. Containers combine an app plus its configuration and dependencies into a single, independently deployable unit. Containers are an excellent fit for bundling and deploying independent microservices. Get started\u00a0<a href=\"https:\/\/dotnet.microsoft.com\/learn\/aspnet\/microservice-tutorial\/intro?WT.mc_id=friends-0000-NANIL\" target=\"_blank\" rel=\"noopener\">writing your first microservice endpoint and containerizing<\/a>\u00a0it to see the benefits.<\/p>\n<h2>More microservices Resources<\/h2>\n<p>Looking for more microservices and cloud-native resources for .NET development? I have you covered in my recent blog post highlighting blogs, videos, eBooks, documentation, and more.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We got some great questions during our recent Let&#8217;s Learn .NET: Microservices event. In this post, Nish Anil answers your top five questions, with links to docs and resources where you can learn more.<\/p>\n","protected":false},"author":593,"featured_media":36391,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[196,197,7252],"tags":[61,95,7544],"class_list":["post-24725","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet-core","category-aspnet","category-cloud","tag-docs","tag-microservices","tag-web-apis"],"acf":[],"blog_post_summary":"<p>We got some great questions during our recent Let&#8217;s Learn .NET: Microservices event. In this post, Nish Anil answers your top five questions, with links to docs and resources where you can learn more.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/24725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/593"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=24725"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/24725\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/36391"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=24725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=24725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=24725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}