1、采用非阻塞运行java程序
#优化启动:非阻塞执行,牺牲CPU换取快速启动
CMD java -Djava.security.egd=file:/dev/./urandom -jar baye-eureka.jar
2、替换boot中的tomcat容器
<!--web 模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!--排除tomcat依赖-->
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<!--undertow容器,比tomcat启动快,吞吐量更大-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
3、指定JVM参数
#赋予适度内存运行
CMD java -Xms50m -Xmx300m -jar baye-eureka.jar