In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what is the essence of micro-service testing". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "what is the nature of micro-service testing"?
Micro-service concept
Micro-service English name Microservice, micro-service architecture model is to organize the entire Web application into a series of small Web services. These small Web services can be compiled and deployed independently and communicate with each other through their exposed API interfaces. They cooperate with each other to provide functions for users as a whole, but can be expanded independently.
Keystone
The basic idea of microservices is to consider creating applications around business domain components.
The main frameworks of micro services include: Dubbo, Spring Cloud, Istio
For the Internet, when it comes to micro-service architecture, we must talk about Devops, that is, the integration of development, testing, deployment, operation and maintenance.
Microservices simplify development by dividing the task of creating complex systems into dozens or even hundreds of small services that are easy to be understood and modified by small teams of software engineers. But microservices don't really eliminate complexity, but migrate it to connect, manage, and monitor a large number of services.
Micro-service and SOA, micro-service is the product of SOA development, it is a relatively modern fine-grained SOA implementation.
The difference between traditional service and micro-service
As you can see, the traditional service is that all the functions are deployed on one machine (left above), and the capacity is expanded by increasing the number of servers! On the other hand, micro services are deployed on a business unit, and different businesses are deployed on different servers, and businesses that are frequently used can also be deployed with more resources (on the right side of the figure, five units are deployed in orange. Rose only deployed one unit), so that resources can be used more reasonably!
The difference of database design between traditional design and micro-service
You can see that all the functions of traditional services correspond to a DB (left above), while microservices can design different DB according to different businesses (right above, one business can correspond to a separate DB).
Core of micro-service architecture design
1: we split the whole system into several subsystems according to the business.
2: multiple applications can be deployed in each subsystem, and load balancing is used among multiple applications.
3: a service registry is required, and all services are registered in the registry. Load balancing is also implemented through the use of certain policies for services registered in the registry.
4: all clients access the services in the background through the same gateway address. Through routing configuration, the gateway determines which service processes a URL request. Load balancing is also used when requests are forwarded to the service.
5: services sometimes need to access each other. For example, there is a user module, when other services handle some business, they need to obtain the user data of the user service.
6: a circuit breaker is needed to handle timeouts and errors during service invocation in a timely manner to prevent paralysis of the overall system due to problems with one of the services.
7: also need a monitoring function to monitor the time spent on each service call, etc.
SpringCloud
Spring Cloud is a complete framework for implementing micro-services based on SpringBoot. It provides the components of configuration management, service discovery, circuit breaker, intelligent routing, micro-agent, control bus, global lock, decision campaign, distributed session and cluster state management needed for micro-service development.
Official website: https://springcloud.cc/
Features:
Distributed / versioned configuration
Service registration and discovery
Routin
Service-to-service call
Load balancing
Circuit breaker
Distributed message delivery
The main components of SpringCloud are shown below:
The pom configuration file of a SpringCloud project is as follows, which can be simply understood as in SpringCloud.
In the pom.xml of the project, what function do you need? just introduce it directly into the project.
Since we mainly introduce the concept of micro-services here, we will not explain too much about the development of springcloud.
Micro-service testing
Front-end UI
It's no different from traditional testing, because you only do functions, so you can't feel the architecture change!
Server side
Microservices are usually exposed using REST over HTTP, so testing of microservices is equivalent to interface testing. Test the function, performance and security of the interfaces provided by the microservice. The specific test methods are as follows:
1. Each micro-service interface can be invoked by building a request, which can be done by coding or tool simulation.
Code: python (unittest+requests); Java (junit4+httpclient)
Tool simulation: jMeter, soupUI, postman, etc.
two。 Verification of requests: in addition to verifying the return value of the interface, pay attention to load balancing (whether requests are distributed to multipoint applications)
3. Monitoring: monitoring through tools SpringCloud Sleuth, Turbine, Prometheus
4. Logs: centralize management logs through ELK (ElasticStack)
Key points:
Under the micro-service architecture, we not only need to protect the integrity of each module within each service, but also need to pay attention to the interaction between modules and services.
Difficulties:
1. Relevance: microservices typically interact with multiple microservices. When a service changes, it will directly affect other dependent services.
two。 Reliability: in order to reduce the high dependence of communication between microservices on network conditions as much as possible, and reduce the failure rate caused by network instability, the isolation mechanism will be designed when designing the microservice architecture.
3. Data consistency: microservices are designed based on distributed systems, so it is necessary to consider the problem of data consistency in distributed systems.
Thank you for your reading. the above is the content of "what is the essence of micro-service testing". After the study of this article, I believe you have a deeper understanding of the nature of micro-service testing. the specific use situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.