Learn about microservices in one article

Original author: NGINX

Original link: Learn about microservices in one article

Reprint source: NGINX Chinese official website


The only official Chinese community of NGINX, all at nginx.org.cn 

 Microservices are a way to build complex applications using multiple small components. This article explains how it works, its pros and cons, and the advantages it can bring.

What are microservices?

Microservices are a software architecture approach to building large, complex applications using multiple small components, each performing a function such as authentication, notifications, or payment processing. Each microservice is an independent unit in a software development project, with its own code base, infrastructure, and database. Microservices work together and communicate through Web API or message queues to respond to incoming events.

Simplified microservices architecture

Simplified microservices architecture

Video about microservices

  • What are microservices?

  • NGINX Plus helps BuzzFeed migrate to microservices

Click here to watch a detailed explanation video >>

Why use microservice architecture?

In traditional monolithic architecture, all functions of an application are implemented in a single code base. This approach has several drawbacks:

  • As applications become more complex, it becomes difficult for any one developer to make sense of the entire code base. It can also be difficult for new developers to get started. One solution is to assign different functional modules to different developers or teams. This makes it easier for developers to control their own code, but the problem is that it makes it harder to track dependencies with other modules. Therefore, changes in one module are likely to affect other modules.

  • When you need to add or enhance functionality, you must compile and test the entire application to verify that the change does not break compatibility between modules. Then you must deploy the entire app as a single binary.

The microservice architecture divides application functions into multiple independent microservices (services), which helps simplify CI/CD. Microservices are faster to develop and easier to understand and maintain. Each service can be developed independently by a team focused solely on that service. The team can choose the programming language, development platform, and database that are best suited for the microservices. Microservices are often packaged as containers to further simplify deployment.

Microservices are loosely coupled, meaning they do not depend on the internals of other microservices. They communicate through APIs. As long as the APIs exposed by each microservice remain backwards compatible, changes to one microservice do not need to be updated in any other microservice.

In short, developers who want to make changes in a microservices architecture can do so within a single microservice container, whereas developers operating in a monolithic architecture may have to spend a lot of time rewriting The whole stack.

Microservice user groups

In order to quickly respond to changing business needs, technical teams have turned to microservice architecture. Developers are leading this change, in large part because more enterprises are giving developers the power to choose their apps and delivery tools. An NGINX user survey conducted in 2020 showed that more than half of respondents use microservices in some or all of their applications. In 2022, more NGINX users working at companies that are moving away from monolithic systems say they are adopting microservices in part because of the scalability that container orchestration allows.

Microservices 101: Pros and Cons

Microservices can transform traditional monolithic applications into more flexible, secure, and efficient architectures, helping you save significant time, cost, and resources. Below is a summary of the pros and cons of microservices that can impact application performance and design.

advantage:

  • Developers are free to develop and deploy services independently, allowing for faster decision-making.

  • Thanks to their small size and autonomy, a microservices-based approach can shorten development cycles because different teams can implement different services at the same time. Dependencies between teams are often reduced or even eliminated.

  • Microservices can be easily deployed into containers, helping to reduce overhead and improve portability across different environments.

  • Because microservices easily integrate with CI/CD tools, developers can implement modern DevOps practices such as automated CI/CD pipelines.

  • Easily scale your applications and "resize" them as needed because each service is typically elastic.

  • Microservices are easier to build, test, and maintain.

  • Services are organized and implemented around business functions.

  • Developers can adopt the technology that is best suited for a specific service.

  • Easier isolation of failures – If one microservice fails, other microservices can still continue to run.

shortcoming:

  • Microservices architecture increases complexity because developers must reduce fault tolerance, reduce network latency, deal with different programming languages, and load balance across multiple services.

  • Troubleshooting microservices can be cumbersome and complex due to their distributed nature.

  • Increasing the number of microservices in an application increases integration and management efforts.

  • Handle multiple databases

Are APIs microservices?

In short, no. APIs themselves are not microservices. But APIs are increasingly being integrated into microservices architectures as communication mechanisms within applications. The functionality of a microservice is exposed as a set of API endpoints, and other microservices invoke that functionality by making API calls to the corresponding endpoints.

Why use containers to run microservices?

Containerization platforms enable developers to isolate, scale, and deploy microservices in the most efficient manner regardless of infrastructure constraints while minimizing disruption to users. Consider a scenario where a single load balancing and traffic routing server cluster is deployed in front of your application. With a static public IP address published in DNS, clients can send their requests to this stable entry point, which is then forwarded to the appropriate container. If these containers are added or removed, simply update the internal address to direct these requests to the new IP address. You can also publish these addresses internally via DNS.

Microservice case

Microservices accelerate seamless and secure migration in highly regulated industries

A multinational company operating in a highly regulated industry must upgrade its systems according to a prescribed timeline to ensure compliance with evolving standards and best practices. The company's application portfolio processes millions of transactions through its systems every day. Over the years, the company has remained compliant with industry requirements even during open source upgrades and third-party security plugin integrations. However, in a recent upgrade, the company encountered some difficulties due to plugin mutual exclusion issues. The company had considered moving from its data center to the AWS public cloud, but security plug-in issues prompted a move to a microservices architecture. This solution is less expensive and helps the company achieve security compliance quickly.

Read this customer success story to learn more about microservices migration.

blog post

Success stories and use cases

References

Resource recommendations

Click here to view the Microservices June 2023 agenda content and all course replays for free.


The only official Chinese community of NGINX, all at  nginx.org.cn

More NGINX-related technical information, interactive Q&A, series of courses, and event resources:  Open Source Community Official Website  |  WeChat Official Account

The pirated resources of "Qing Yu Nian 2" were uploaded to npm, causing npmmirror to have to suspend the unpkg service. Zhou Hongyi: There is not much time left for Google. I suggest that all products be open source. Please tell me, time.sleep(6) here plays a role. What does it do? Linus is the most active in "eating dog food"! The new iPad Pro uses 12GB of memory chips, but claims to have 8GB of memory. People’s Daily Online reviews office software’s matryoshka-style charging: Only by actively solving the “set” can we have a future. Flutter 3.22 and Dart 3.4 release a new development paradigm for Vue3, without the need for `ref/reactive `, no need for `ref.value` MySQL 8.4 LTS Chinese manual released: Help you master the new realm of database management Tongyi Qianwen GPT-4 level main model price reduced by 97%, 1 yuan and 2 million tokens
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/5246775/blog/11184822