简体   繁体   English

在Docker上运行的Spring Cloud Netflix App被容器杀死了吗?

[英]Spring Cloud Netflix apps running on Docker are killed by the container why?

I am testing some Spring Cloud Netflix microservices running them as individual Docker containers on Windows. 我正在测试一些Spring Cloud Netflix微服务,它们在Windows上作为单独的Docker容器运行。

There are quite a few of them, ten or more. 其中有很多,十个或更多。 The point is that after running some of them 7, 8... the applications' performance start to decline and some of the containers are killed, for instance I see: 关键是,在运行其中一些7、8 ...之后,应用程序的性能开始下降,并且某些容器被杀死,例如,我看到:

2017-01-24 14:05:52.165  INFO 5 --- [nfoReplicator-0] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@67b129a3: startup date [Tue Jan 24 14:05:52 GMT 2017]; root of context hierarchy
Killed
  • Why is the performance being affected? 为什么性能会受到影响?
  • Is it a memory issue? 这是内存问题吗? How can I solve it? 我该如何解决?
  • How can I prevent my containerized java apps from being killed? 如何防止我的容器化Java应用程序被杀死?

I am using the same Dockerfile for the applications (each of them changes the ADD command): 我为应用程序使用了相同的Dockerfile(它们每个都更改了ADD命令):

FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD archimedes-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

I am wondering if it is necessary to provide the -Xms and -Xmx flags to force a minimum/maximum available memory... 我想知道是否有必要提供-Xms和-Xmx标志以强制最小/最大可用内存...

On the other hand, the more containers I start, the less responsive the applications are...but Window's task manager doesn't show any CPU/RAM exhaustion. 另一方面,我启动的容器越多,应用程序的响应就越慢...但是Window的任务管理器没有显示CPU / RAM耗尽。 Maybe I have to tune the Windows Docker installation? 也许我必须调整Windows Docker安装?

The code is available here: https://github.com/codependent/storyteller-microservices/tree/high-availability-rxjava 可以在这里找到代码: https : //github.com/codependent/storyteller-microservices/tree/high-availability-rxjava

To start every microservice, under every folder there's a startContainer.sh that shows the docker commands I am using, for instance: 要启动每个微服务,在每个文件夹下都有一个startContainer.sh,其中显示了我正在使用的docker命令,例如:

mvn clean package docker:build -DskipTests
docker run -e "SPRING_PROFILES_ACTIVE=archimedes1" -p 8761:8761 \
  --name archimedes1 --add-host archimedes1:192.168.99.100 --add-host archimedes2:192.168.99.100 --add-host my-rabbit:192.168.99.100 \
  -d storyteller/archimedes 
docker run -e "SPRING_PROFILES_ACTIVE=archimedes2" -p 8762:8762 \
  --name archimedes2 --add-host archimedes1:192.168.99.100 --add-host archimedes2:192.168.99.100 --add-host my-rabbit:192.168.99.100 -d storyteller/archimedes

I fixed it by assigning more memory to the VirtualBox: in the settings view, System tab --> Base Memory 4GB. 我通过为VirtualBox分配更多内存来修复它:在设置视图的“系统”选项卡->“基本内存4GB”中。

With this the containers run smoothly and aren't being killed. 这样,容器运行平稳且不会被杀死。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么部署在Docker容器上的Spring Cloud Netflix应用程序需要显式设置eureka.instance.hostname? - Why do Spring Cloud Netflix applications deployed on Docker containers require explicitly setting eureka.instance.hostname? Spring cloud netflix和HystrixObservable - > JsonMappingException - Spring cloud netflix and HystrixObservable --> JsonMappingException 我应该如何在EC2实例中包含的Docker中使用Netflix Zuul和Eureka配置Spring Cloud - How should I configure Spring Cloud with Netflix Zuul and Eureka in a Docker contained in an EC2 instance Spring 在 docker 容器中运行的应用程序无法访问 - Spring application running in docker container is not reachable Spring Cloud Eureka Netflix zuul 过滤器 - Spring Cloud Eureka Netflix zuul filters Spring Cloud Netflix / refresh注销服务 - Spring Cloud Netflix /refresh deregisters service 具有Spring Cloud Config服务器的Netflix Archaius - Netflix Archaius with Spring Cloud Config server 春云netflix球衣版冲突 - spring cloud netflix jersey version conflict Spring Cloud Netflix:使用ZuulServlet在ZuulConfiguration中发生了什么? - Spring Cloud Netflix: Whats happening in ZuulConfiguration with the ZuulServlet? 在Spring Cloud Netflix Zuul中以编程方式设置路由 - Setting the route programmatically in Spring Cloud Netflix Zuul
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM