[英]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
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.