Today after eating the rest of the time to wander around, suddenly see this a problem Spring cloud in the domestic small and medium-sized companies can use it up? , attracted my attention. Carefully read the question of the main problem, found that this is a good question, the main subject after a reflection, and with a full picture of their own questions expressed, as a research and use spring Cloud for the last two years, the programmer, see my hands itch not to reply.
Good question
Good questions must be answered carefully, carefully read the question of the main problem, found that the problem is very representative, may be the vast number of netizens want to use spring cloud but also the spring cloud is not familiar with the common idea, the main theme of the spring cloud use of all aspects of thinking , including market, learning, front-end, test, configuration, deployment, development, and operations, here are the main questions:
I want to promote Spring Cloud in the company, but I have a lack of understanding of the technology, drawing a brain map, summed up a variety of problems.
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/06/5F/wKiom1m3UW6yrheAAAFTKIn45AU668.png "title=" 1.png "alt=" Wkiom1m3uw6yrheaaaftkin45au668.png "/>
is micro-service a structure like this?
Front-end or two-party-> NG cluster--zuul cluster--eureka-server cluster--service provider Cluster
(two means other business units)
To understand this, you first need to know what spring Boot is, what is Spring Cloud, and what is the relationship between the two?
What is Spring Boot
Spring Boot simplifies spring-based application development by creating a standalone, product-level Spring application with a small amount of code. Spring Boot provides out-of-the-box settings for the spring platform and third-party libraries so you can get started in a methodical manner. Most spring Boot applications require only a small spring configuration. Spring Boot is a new framework provided by the Pivotal team designed to simplify the initial setup and development of new Spring applications. The framework uses a specific approach to configuration, which eliminates the need for developers to define boilerplate configurations.
In my words, spring boot is not really a new framework, it is configured with many frameworks by default, as Maven integrates all the jar packages, and spring boot integrates all the frameworks (not knowing if the analogy is appropriate).
The core idea of Spring Boo T is that the Convention is larger than the configuration and everything is done automatically. With Spring Boot, you can greatly simplify your development model, and all the common frameworks you want to integrate with the corresponding component support. If you do not understand the Spring Boot completely, you can refer to my article:springboot (a): introductory article
What is Spring Cloud
Spring Cloud is an ordered collection of frames. It uses spring boot's development convenience to subtly simplify the development of distributed system infrastructures, such as service discovery registration, Configuration center, message bus, load balancer, circuit breakers, data monitoring, and so on, all of which can be started and deployed with spring boot development style.
Spring does not reinvent the wheel, it simply combines the more mature and proven service frameworks currently developed by companies, masking the complexities of configuration and implementation through the Spring Boot style, and ultimately leaving developers with a set of easy-to-understand, Easy-to-deploy and maintainable Distributed system Development Kit.
MicroServices are service units that can be deployed independently, horizontally scaled, independently accessible (or have a separate database), and Spring Cloud is the steward of these microservices, and with this architecture of microservices, the number of projects is very large, and spring cloud Being a big housekeeper requires a variety of programs to maintain the entire ecosystem.
Spring Cloud is a set of distributed service governance framework, since it is a set of service governance framework, it does not provide specific functional operations, more focused on the communication between services, fuse, monitoring and so on. So you need a lot of components to support a set of features, if you are not particularly familiar with the Spring cloud components, you can refer to my article:Springcloud (a): Big talk Spring Cloud
Spring Boot and Spring Cloud relationships
Spring boot is a set of spring's fast-provisioning scaffolding that can quickly develop a single microservices based on spring boot, and Spring cloud is a spring boot-based cloud application development tool; Spring boot focuses on fast, easy set To a single micro-service entity, Spring Cloud focuses on the global Service governance framework; Spring boot uses a default greater than the configuration concept, many integration options have been chosen for you, can not be configured without configuration, a large part of Spring cloud is based on the spring Boot To implement, can not be based on Spring Boot? No.
Spring boot can leave spring cloud to use the development project independently, but spring cloud is dependent on spring boot.
Spring-and Spring Boot > Spring Cloud Relationships.
Reply
Here is the answer I know.
First of all, the landlord asked these questions are very good, considered that after their own thinking, I happened to experience what you said small and medium-sized companies, and all use Spring Cloud and has been put into production on-line. The first company technology developers about 15 people, projects more than 30, the second company development staff about 100 people, project instances of more than 160.
The truth is that spring Boot, Spring Cloud is still in high-speed development, the technology ecosystem continues to improve and expand, inevitably there will be some small bugs, but for the use of small and medium-sized companies will be completely ignored, the basic can find a solution, then back to your question.
1. Market
As far as I know, many well-known internet companies have used spring cloud, such as Ali, the United States, but are small-scale, not as I experienced the two companies, the line of business all embraced spring cloud, and spring cloud is not a high-tech, ordinary Java Programmers can get started after one or two months, but they need a more proficient person to lead the stage.
2. Learning
There are many ways that now spring cloud is getting more and more rich with resources, looking at official documents and examples, and now a lot of good blogs are writing about spirng Cloud tutorials, and I've collected some of the spring Boot and spring cloud phases Resources can be consulted, find a blog will find people and organizations.
Spring Boot Learning Data Summary:
Spring Cloud Learning Data Summary:
3. Division of responsibilities before and after
In fact, this is a problem that every system architecture should consider, Spring Cloud is just a set of frameworks for back-end service governance, and the only thing that matters to the front end is that Thymeleaf,spring recommends using it as a template engine. In general, the front-end app or Web page through Zuul to call back-end services, if it contains static resources can also use Nginx to do proxy forwarding.
4. Testing
Spring-boot-starter-test supports testing of the various layer methods in the project, and also supports various properties of the controller layer. So the general test of the step is this, the first developer to cover all of their own methods, and then test all the external interface within the microservices to ensure the correctness of the microservices, and then the micro-service integration test, the final delivery test.
5. Configuration
Session sharing can be done in a number of ways, such as using the Tomcat sesion sharing mechanism, but I recommend using the Redis cache for session sharing. Can be introduced in batches, I in the last company is a partial transition on-line, new and old projects through Zuul interaction, batch introduction, preferably the new business line first use Spring Cloud, the old business to do the transition, when fully mastered after the replacement. If just request forwarding, Zuul performance is not necessarily lower than nginx, but if it involves static resources, it is recommended to use Nginx in front of the agent. In addition Spring Cloud has a configuration center that can be very flexible to do all the configuration things.
6. Deployment
Multi-environment configuration, Spring boot is best at doing this, using different configuration files to configure different environment parameters, when the service starts to indicate a configuration file, for example: Java-jar App.jar--spring.profiles.active= Dev is the configuration file that launches the test environment, and Spring Cloud does not provide a publishing platform because Jenkins is perfect enough to recommend using Jenkins to deploy the Spring Boot project, which will save a lot of things; Grayscale is temporarily unsupported and may need to be done yourself, If you have more than one instance, you can update it one by one; it is common to support hybrid deployments and multiple deployments of a single machine.
7. Development
You said that contains the HTML interface is the front page, spring Boot can support, but in fact, Spring MVC is doing this thing, spring Cloud only to do service governance, and other specific functions are integrated with a variety of frameworks to solve it; Excel reports can, in fact, in addition to the S Other Java projects are conceivable outside of the wing project, and Spring Cloud and old projects can be mixed and supported by Zuul. Whether callback is supported, can be implemented through MQ, or that Spring Cloud is just service governance.
8. Operation and Maintenance
Turbine, Zipkin can be used for fusing and performance monitoring, dynamic on the downline of a node can be achieved through Jenkins, provider offline, there will be other same instances to provide services, Eureka interval time to detect the availability of services Different node configurations different traffic weights are not currently supported. The registry must be a highly available cluster, and after the registry is hung up, the service instances will all stop.
Summary, whether SMEs can use Spring cloud, completely depends on the environment of their own company, if it is a technology-active team to try it boldly, now Spring Cloud is the best solution for all microservices governance, is a trend, the next year or two may be like Spring is as popular as early contact with early learning is not better.
I hope I can answer your question.
Spring Cloud Architecture
Let's take a holistic look at the main components of Spring Cloud and its access process
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/A5/11/wKioL1m3VgGR2nPXAAgpRa_9hHo818.png "title=" 2.png "alt=" Wkiol1m3vggr2npxaagpra_9hho818.png "/>
1, external or internal non-Spring Cloud projects are unified through the API Gateway (Zuul) to access internal services
2, after the gateway receives the request, obtains the available service from the Registration Center (EUREKA)
3, after the balanced load by the Ribbon, distribution to the backend of specific instances
4, micro-service between the communication processing business through feign
5. Hystrix is responsible for processing the service timeout fuse
6. Turbine monitoring service calls and fuse-related indicators
The configuration center is not drawn in the diagram, and the configuration center manages the configuration files for each microservices in different environments.
The above is a complete Spring Cloud eco-map.
finally send a complete example of the SPIRNG Cloud open source project waiting for you to Spring-cloud-examples
A pure Smile
Source: www.ityouknow.com/
Copyright belongs to the author, please specify the source of the reprint
Can Spring cloud be used by small and medium-sized companies in China?