{"id":18155,"date":"2020-09-04T06:43:28","date_gmt":"2020-09-04T06:43:28","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=18155"},"modified":"2020-09-04T06:43:31","modified_gmt":"2020-09-04T06:43:31","slug":"what-to-avoid-with-microservices","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-to-avoid-with-microservices\/","title":{"rendered":"What to avoid with microservices"},"content":{"rendered":"\n<p class=\"has-text-align-left\">Architectures and approaches normally turn into trends because enough use cases exist to corroborate their genuine usefulness when solving a particular problem or class of problems. In the case of microservices, before they were trendy, enough companies built monoliths beyond their manageability. They had a real problem on their hands, which was a large<br>an application that fundamentally clashed with the modern ways of scaling, managing, and evolving large systems in the cloud.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"275\" height=\"183\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/09\/images.jpeg\" alt=\"\" class=\"wp-image-18162\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-left\"><br>Through some trial and error, they reinvented their properties as a loose collection of microservices with independent scalability, lifecycle, and data concerns. The case studies in 1.5, \u201cCase studies and most common architectural patterns\u201d on page 14 are just a small sample of companies successfully running microservices in production. It is important to remember these use cases because the trendiness of microservices<br>threatens to compel developers to try them out in contexts where they are not meant to be used, resulting in project failures in some cases. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/09\/Blog_post_june-Recovered-44-1024x682-1.png\" alt=\"\" class=\"wp-image-18161\" width=\"491\" height=\"327\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/09\/Blog_post_june-Recovered-44-1024x682-1.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/09\/Blog_post_june-Recovered-44-1024x682-1-300x200.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/09\/Blog_post_june-Recovered-44-1024x682-1-768x512.png 768w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-left\">This is bad news for practitioners who derive genuine benefits from such an architecture. The following section identifies where microservices are not a good choice. It helps limit incurring costs of implementing microservices infrastructure and practices when it is warranted. It also helps avoid the microservice hype, and prevent some failures that would sour people to an otherwise sound technical approach.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. Don\u2019t start with microservices<\/h4>\n\n\n\n<p><br>When beginning new applications, do not demand that microservices be included in them. Microservices attempt to solve problems of scale. When you start, your application is tiny. Even if it is not, it is just you or maybe you and a few more developers. You know it intimately, and can rewrite it over a weekend. The application is small enough that you can easily reason about it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><br>2. Don\u2019t even think about microservices without DevOps<\/h4>\n\n\n\n<p><br>Microservices cause an explosion of moving parts. It is not a good idea to attempt to implement microservices without serious deployment and monitoring automation. You should be able to push a button and get your app deployed. In fact, you should not even do anything. Committing code should get your app deployed through the commit hooks that trigger the delivery pipelines in at least development. You still need some manual checks and balances for deploying into production. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><br>3. Don\u2019t manage your own infrastructure<\/h4>\n\n\n\n<p><br>Microservices often introduce multiple databases, message brokers, data caches, and similar services that all need to be maintained, clustered, and kept in top shape. It really helps if your first attempt at microservices is free from such concerns. A PaaS, such as IBM Bluemix or Cloud Foundry, enables you to be functional faster and with less headache than with an<br>infrastructure as a service (IaaS), providing that your microservices are PaaS-friendly.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><br>4. Don\u2019t create too many microservices<\/h4>\n\n\n\n<p><br>Each new microservice uses resources. Cumulative resource usage might outstrip the benefits of the architecture if you exceed the number of microservices that your DevOps organization, process, and tooling can handle. It is better to err on the side of larger services,<br>and only split when they end up containing parts with conflicting demands for scaling, lifecycle, or data. Making them too small transfers complexity away from the microservices and into the service integration task. Don\u2019t share microservices between systems.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">5. Don\u2019t forget to keep an eye on the potential latency issue<\/h4>\n\n\n\n<p><br>Making services too granular or requiring too many dependencies on other microservices can introduce latency. Care should be taken when introducing additional microservices. When decomposing a system into smaller autonomous microservices, we essentially increase the number of calls made across network boundaries for the services to instrumentally handle a request. These calls can be either service to service calls or service<br>to persistence component calls. Those additional calls can potentially slow down the operating speed of the system. Therefore, running performance tests to identify the sources of any latency in any of those calls is fundamental. Measurement is undoubtedly important so that you know where bottlenecks are. For example, you can use IBM Bluemix Monitoring and Analytics service for this purpose. Beyond that, services should be caching aggressively. If necessary, consider adding concurrency,<br>particularly around service aggregation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Architectures and approaches normally turn into trends because enough use cases exist to corroborate their genuine usefulness when solving a particular problem or class of problems. In the case of microservices, before they were trendy, enough companies built monoliths beyond their manageability. They had a real problem on their hands, which was a largean application&#8230;<\/p>\n","protected":false},"author":14,"featured_media":18165,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[5124],"tags":[],"class_list":["post-18155","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microservices"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/18155","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=18155"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/18155\/revisions"}],"predecessor-version":[{"id":18166,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/18155\/revisions\/18166"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/18165"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=18155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=18155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=18155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}