Monomer apps do have problems!

Recently in the research of micro-service architecture, I have a little experience, and I plan to write several articles on the public account and share them with you slowly.

This topic is a bit big, AND I will tell you slowly in several articles. Today, I will first talk about the disadvantages of traditional single application. It is precisely because of the disadvantages of single application that we have to consider the development of micro services.

The history of human development is a history of continuous refinement of social division of labor. From this perspective, micro-service, which divides a complex large project into many small projects and then programmers work together to complete the project, is in line with the historical trend of cooperation.

This is we stand in today’s point of view, once the single application is also a representative of advanced productivity.

However, with the development of the Internet, we have higher and higher requirements for a system, and it is difficult for individual applications to adapt to the current development. Therefore, before answering the question why we use microservices, it is necessary to talk about what problems individual applications are currently facing.

Problems faced

1. Overly complex projects

You want to create a simple user management system, without saying a word, just create a Maven project and get started, and that’s fine, because it’s easy.

But you want to make a Taobao station, or you want to make a ufida U8 system, then you have to slowly design the system architecture. Single application, because it is a project, all functions are written in a project, it is inevitable that the project is too complicated. And the complexity will get worse.

Some friends may have such experience. They just joined a company and took over a new project, which was urgently urged to fix several bugs. The project is complicated, and there are several beans, models, poJOs and so on in the entity package alone. After two weeks of working on the project, you decide that it’s too bad to work on it, so you get a project that’s taken a step up in complexity.

In this way, an original simple single project, on the way to become complex, gone forever.

2. Slow development

Single monomer application development speed is slow, because after the application of complex projects become bloated and unusually large, every compile build, run and test, it takes a lot of time, and if the test has a problem, again from the beginning again, note that every compile from building is construction of the entire project from the beginning to compile.

Even if you only need to change one parameter, you still have to go through the whole process, which means that each change is a very important operation.

You can’t go fast enough.

3. Not easy to expand

Performance requirements of the project in different modules on the computer, for example, using Redis to save a large amount of hot data, so we hope the server memory is very big, in addition, there are a module involves image processing, we hope that the server’s CPU is very strong, if is single application deployment, server to meet these conditions.

4. The technology stack is not easy to expand

Another disadvantage of individual apps is that the technology stack is difficult to scale. Once you choose a technology stack to develop a project on, it is difficult to switch from one technology stack to another. Some companies will also get a set of system, this look like you don’t have what problem at that time, but after a few years later, look back, is already out of date, very low, the original design system may have left, has just hired a novice also dare not move the old things, can only bite the bullet on the old development.

Sometimes you have a service that needs to handle high concurrency, and you want to do it in Go, but you can’t do it in another language.

These are the disadvantages of a single application. If there are microservices, these problems will be solved.

Former advantages

Of course, everything has two sides, single application also has its own advantages, for example:

  • Easy to develop, an IDE can quickly build a single application
  • The test is simple
  • Deployment is simple. Once Tomcat is installed, just throw the application on
  • Clustering is also easy, with multiple Tomcat and one Nginx setting up a clustered environment in minutes

So many advantages, still difficult to hide the disadvantages.

However, when we do the project, or to choose according to the actual situation, not because of the micro service, all projects are micro services, if you just want to do a user add, delete, change and check, then obviously, to create a simple single application is the most appropriate.

Well, this article has mainly shared with you some of the problems of traditional monolithic applications, and it is because of these problems that we need to introduce microservices. In the next article, we will look at the advantages of microservices.

References:

[1] Chris Richardson. Design patterns for microservices architecture [M]. Beijing: China Machine Press, 2019.

Pay attention to the public account [Jiangnan little Rain], focus on Spring Boot+ micro service and front and back end separation and other full stack technology, regular video tutorial sharing, after attention to reply to Java, get Songko for you carefully prepared Java dry goods!