Spring Boot did not think could be so much memory consumption, a little surprised

Spring Boot Overall, it is quite easy to build, especially in Spring Cloud family bucket, referred to as micro-services close to the people, but the trends in container technology has matured, the face of huge memory consumption Spring Boot, represented by small companies do not play. Today, many JAVA micro-services framework had just been born mostly hit "lightweight", mainly because Spring Boot too.

JAVA-based micro-services framework

No1-Spring Cloud

Introduction

There are big backer in Spring, updates, stability problems, maturity does not need to consider. In the JAVA-based mix of technical staff have heard about Spring's name it, so no shortage of programmers ...... and start of the difficulty of this very low, an architect may be omitted entirely.

However, you are bound to pay on the server:

  • At least one "service discovery" of the server;

  • There may be a unified gateway Gateway;

  • You might need for a "distributed configuration management" Configuration Center;

  • Possible "service tracking," I know the request came from, where to go;

  • You may need to "cluster control";

  • After the line found on the project, we need a lot of servers, each server in the cluster increases, are feeling distressed;

Pressure measured 30 seconds

Before the pressure test memory footprint


Spring Boot did not think could be so much memory consumption, a little surprised



As shown, the memory footprint 304M.

When the memory footprint of pressure measurement


Spring Boot did not think could be so much memory consumption, a little surprised



As shown, memory footprint 1520M (1.5G), CPU increased to 321%

Overview


Spring Boot did not think could be so much memory consumption, a little surprised



to sum up

Simple application of a Spring Boot, at least 1G memory, JAR after a relatively small micro-business point of service will be compiled about 50M; and components Spring Cloud will be introduced relatively more, consume more resources will be relatively few.

Start-up time of about 10 seconds or so: Started Application in 10.153 seconds (JVM running for 10.915)

JAVA-based reactive programming toolkit Vert.x

Introduction

Eclipse's Eclipse vert.x backrest is used to build a formula in response to the application toolkit of the JVM. Positioning does not conflict with the Spring Boot, even Vert.x can combine Spring Boot use. Many Vert.x module provides a large number of micro assembly services, in many people's eyes is to select a micro-services architecture.

Huawei micro service framework Apache ServiceComb is to Vert.x as the underlying framework to achieve, in the "benchmarking website TechEmpower" in, Vert.x's performance is very brisk.

Pressure measured 30 seconds

Before the pressure test memory footprint


Spring Boot did not think could be so much memory consumption, a little surprised



As shown, the memory footprint 65M.

When the memory footprint of pressure measurement


Spring Boot did not think could be so much memory consumption, a little surprised



As shown, memory footprint 139M, CPU accounting for 2.1%, the feeling does not seem to be pressure test.

Overview


Spring Boot did not think could be so much memory consumption, a little surprised



to sum up

After completion Vert.x single serving packaged approximately about 7M JAR, the container does not depend Tomcat, Jetty like, running directly on the JVM.

Vert.x resource consumption is very low, feeling a 1-core 2G server has been able to deploy many Vert.x service. Coding aspects of the problem is removed, really in line with small projects and small module. Git has appeared on the market based on open source gateway Vert.x implemented - help VX-API-Gateway documentation

https://duhua.gitee.io/vx-api-gateway-doc/

Multi-language support, it is suitable for small projects on line quickly.

Start-up time of less than one second: Started Vert.x in 0.274 seconds (JVM running for 0.274)

Other JAVA-based micro-Services Framework

Spark Java

  • jar is relatively small, about 10M

  • Accounting for small memory, about 30 ~ 60MB;

  • Performance can also, with similar Spring Boot;

Micronaut

  • Grails new favorite team;

  • Micro-services-based applications can use Java, Groovy and Kotlin write;

  • Compared Spring Boot has more comprehensive;

  • Better performance, and encoding more similar Spring Boot;

  • Startup time and memory consumption more efficient than other aspects of the frame;

  • multi-language;

  • Dependency injection;

  • Built-in features a variety of local cloud;

  • Very new, just released 1.0.0

Jvlin

  • Very easy to get started;

  • Flexible, compatible synchronous and asynchronous programming ideas;

  • JAR small, 4 ~ 5M;

  • multi-language;

  • KOA's shadow;

  • Only about 2,000 lines of source code, source code is simple enough to understand and repair;

  • With the current trend;

  • multi-language;

  • Embedded server Jetty;

Quarkus

  • Fast start;

  • JAR small, about 10M;

  • Little documentation;


Guess you like

Origin blog.51cto.com/14455981/2434821