Simplifying the World of Microservices and Container Technology

简介: This is part of a series of articles on the development of the docker-based Spring Cloud microservices application on the Alibaba Cloud Container Serv

With the proliferation of online applications, their architectures need to continuously evolve to make them stand out in the multitude of similar apps. Applications must be highly available and resilient while running on cloud environments. To ensure a consistent user experience, organizations need to frequently roll out updates, even multiple times in a day. However, monolithic web applications that serve up HTML to desktop browsers cannot cope with such regular updates and hamper developers’ productivity.

This led to the need for a new architecture: Microservices.

Let’s see what it stands for ?

Microservice Overview

Microservices is a way of breaking large software projects into loosely coupled modules that communicate with each other through simple APIs.

Microservices architecture involves developing applications as a suite of multiple independent modular services with each of them serving a unique purpose. Each of these services runs a particular process and communicates internally with other modules to serve a business goal.
Let’s dig deeper and understand why microservices architecture is needed.

Need of Microservices Architecture:
An independent application may have different individual modules that cater to the different business or technical needs. For a low-scale application with low complexity, the processing of overall tasks isn’t difficult when all modules are present in the same application. In fact, this improves program debugging speed and ensures a high level of execution efficiency.

However, as the scale of an independent application increases, these benefits soon fade away. With business expansion and changing needs, application backend gradually becomes too complex for developers to manually handle and scale. You need the ability to internally restructure your application based on changing requirements by adding, removing, or changing modules. Dead code appears and restructuring becomes more difficult. Minor changes may often impact the entire application. In this case, to resize or upgrade any module, you have to resize or upgrade all modules in the application. The program's external dependencies become increasingly complex and the scope of automated testing falls.

To address all of these shortcomings, microservice architecture was developed. Let’s see how they bring value to your development process and application efficiency.

Microservices Advantages

An application is made up of multiple services, where each service handles one set of tasks. In microservice architecture, these multiple services communicate with each other using web protocols, such as HTTP or JSON. Microservice advantages are:

  • Resilient: Independent services are easy to discard. During an upgrade, you can easily replace an old service instance with a new one.
  • Easy-to-enhance: The code becomes easy to change, overwrite, and discard as per the requirement.
  • Ease-of-deployment: Deployment or rollback of independent modules become easier and faster without any impact on the remaining system.
  • Improved Fault Isolation: Failure of a single module doesn’t affect other modules present in the application.
  • Individual Services Scalability: Demanding modules or services can be easily scaled up without any need of scaling up the whole application.
  • Hybrid Programming Support: Gives flexibility to select the most appropriate technologies for individual services without any impact on other services.
  • Simplified Development Process: Independent modules can be assigned to different teams/groups to make the overall development process easier and convenient.

Needless to say, Microservices definitely make your life easier, but there are some drawbacks too.

Microservices: A silver bullet?
Although the name includes the qualifier, "micro," its implementation requires manual efforts. If you do not have a complete understanding of the business field and are unaware of the true business needs, the management of multiple services along with numerous relevant processes becomes a daunting task. Besides, the number of processes grows when load balancing and messaging middleware are added. Management, operation, and orchestration of all these services become cumbersome. In addition, you need a DevOps expert for implementation and management of these architectures, which adds to overall overhead.

As microservice architecture acts a distributed system, a certain level of complexity gets added. Also, it can lead to several issues, including network latency, fault tolerance, message serialization, and asynchronicity.

As the number of service instances constantly changes, data traffic fluctuations significantly increase with the complexity of monitoring and log analysis. There are many open source monitoring and log solutions, but it is not easy to construct and customize a set of personalized solutions.

This demands for an all-in-one platform to address your non-functional needs, such as high availability, monitoring, and logs to make it easy to implement and manage a microservices architecture.
The best way to run a microservices application architecture is to use application containers. Container technology allows you to create a standard image from an application and its dependencies, and use this image throughout the process from development through testing to the production environment. DevOps fills in the gap between development and O&M.

Alibaba Cloud, with its efficient container service, is becoming the cornerstone for innovation and enabler for microservices architecture.

Alibaba Cloud Container Service: Comprehensive Platform to Create and Operate Microservices
It is a fully managed cloud container management service that enables you to efficiently run and manage Docker applications on a distributed cluster of Alibaba Cloud ECS instances. It replaces the need to install, operate, and scale your container cluster infrastructure.
In this series of articles, we will explore the use of Spring Cloud in the creation of microservice applications on the Alibaba Cloud Container Service.

Let’s firstly explore the basics of Spring Cloud and Netflix.

Spring Cloud and Netflix Overview

Spring Cloud is a project in Spring framework that provides development capabilities for common modules in distributed systems. These capabilities are configuration management (Config Server), service discovery (Eureka), service fusion (Hystrix), intelligent routing (Zuul), and Netflix OSS-based encapsulations. Using annotation statements, we can easily use Netflix open source products in Spring Boot applications to create microservices applications with production-level availability.
Building Microservices Applications: Sample Code

We are creating a complete microservices application in a virtual scenario which can run locally on Docker or be deployed on the Alibaba Cloud container service. View the sample code.

Comprehending Service-oriented Applications

In our simulated scenario, we break down an enterprise's internal applications into multiple services and enable them to communicate with each other via API calls.

”Foo” and ”bar” are two basic services that use an intranet to access other services via APIs, but do not provide external service over the Internet. “Foobar” as a single application provides external services and must call both foo and bar services during processing.

Inter-Services Logical Architecture Diagram

ea92165f98905e800c78859f34b20774e6a2f7aa


Provided by discovery-server, the service discovery mechanism is based on Eureka. As discovery server is independent of the business, developers can simply use Docker images.

The foobar service provides external service by registering with the intelligent application routing gateway service. The gateway is based on Zuul and because its code is independent of the business, developers can simply use a Docker image. However, Zuul uses configuration files to describe the URL access modes corresponding to different services, and developers will need to change the image configuration files to actually use it or mount a volume to implement configuration file sharing and modification.

The foo, bar, and foobar code contains Eureka and Ribbon Client to provide Eureka self-registration and Eureka query capabilities, while Ribbon implements client load balancing.

During operation, each service is elastically scaled based on its load and may be composed of multiple running instances. During startup, all service instances are automatically registered with the Eureka Server. Inter-service discovery also uses the Eureka Server to fetch instance information and select an instance to access based on the automatic decision of the Ribbon Client. We do not use centralized load balancing, but discover and balance load through the clients.

661c6f64213ed0716ca0eb4d3d3b55584b438f8b
目录
相关文章
|
7月前
|
容器
SAP ABAP ALV 的一些总结:Docking container 和 Dialogbox container
SAP ABAP ALV 的一些总结:Docking container 和 Dialogbox container
100 0
|
6月前
|
JavaScript 前端开发 Shell
什么是 sap.ushell.Container
什么是 sap.ushell.Container
48 0
|
10月前
|
安全 Unix Shell
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 5: Process API
读书笔记系列 - Operating Systems: Three Easy Pieces - Virtualization - Chapter 5: Process API
68 0
|
Kubernetes 容器
《Migrating Legacy Monoliths to Cloud Native Microservices Architectures on Kubernetes》电子版地址
Migrating Legacy Monoliths to Cloud Native Microservices Architectures on Kubernetes
64 0
《Migrating Legacy Monoliths to Cloud Native Microservices Architectures on Kubernetes》电子版地址
Deploy your UI5 application into SAP Cloud Platform and launch as a tile
Deploy your UI5 application into SAP Cloud Platform and launch as a tile
105 0
|
运维 Kubernetes 前端开发
OPENSHIFT CONTAINER PLATFORM CONTROL PLANE
control plane 由 master 机器组成,负责管理 OpenShift Container Platform 集群。control plane 机器管理计算机器(也被称为 worker)上的工作负载。集群本身通过Cluster Version Operator、Machine Config Operator 和一组单独 Operator 的操作来管理对机器的所有升级。
516 0
OPENSHIFT CONTAINER PLATFORM CONTROL PLANE
|
存储 Kubernetes 监控
OPENSHIFT CONTAINER PLATFORM 架构
从OCP4.4的架构介绍看出:1、4版本使用了kubernetes的master、work节点的概念,之前3版本的master、node、infra节点消失了。2、4版本对RHCOS系统支持更好,对RHEL变得不友好;3、3版本中的Docker Container Engine被CRI-O取代;4、4版本正常情况下都需要能够访问互联网才能安装(最初是必须能访问互联网)。
1507 0
|
Serverless Python
Deploy a flexible and highly available image processing service within 10 minutes
Alibaba Cloud Function Compute is an event-driven and fully-managed compute service. With Function Compute, you can quickly build any type of applicat.
1440 0
|
容器
Introduction to Alibaba Cloud Container Service
In this whitepaper, we will take a look at the technologies and origins of containerization, as well as its benefits and challenges.
1172 0
Introduction to Alibaba Cloud Container Service