I have been testing Quarkus, to check if it's worth the replacing cost, when running an empty Quarkus project with only resteasy and jsonb , the RAM usage is of just 5MB. But after adding only some entities from a big project, the project has grown to 100MB, which I find as an abusive usage, as in the Spring one, the full project is using 180MB.
Reproduction repository: https://github.com/KevinGuancheDarias/quarkus-owge-poo
running natively steps (requires docker)
$ mvn package -Pnative -Dquarkus.native.container-build=true -DskipTests
$ docker build --no-cache -f src/main/docker/Dockerfile.native -t quarkus/test .
$ docker run -i --rm -p 8080:8080 quarkus/test
Command used to test the sizes
docker stats 2985d8366e51 32db5040f6e7
Sample output where owge_all_dockerized.... is the full project running in Docker and suspicious_borg is the quarkus test
Quarkus extensions: agroal, cdi, hibernate-orm, hibernate-orm-panache, jdbc-mysql, mutiny, narayana-jta, resteasy, resteasy-jsonb, smallrye-context-propagation
Is this the expected RAM usage?
Update: Removing only hibernate ORM, but preserving agroal and jdbc-mysql, makes the memory go down to 6MB
Update: Please note, that both the quarkus test and the full project running in Spring boot are immediately started, and stopped, no time for GC to fill up the memory
Thanks in advance!.
Native graalvm execution has a different kind of memory management than when running traditional Java/jar.
Details are to be found in the official docs but basically it will grow in memory more aggressively but you can limit it by adding -mx 10m for example. Then it will not grow beyond 10 mb - which if is enough for your app will be fine.
Of course if your app actually needs more then increase it.
Related
I installed quarkus, but it is failing when trying to download resources. I installed podman, podman-compose, podman-docker and podman-remote.
It looks like podman-compose is not being called by 'docker compose'. Is there another package I need to install or configure on RHEL9 to use Quarkus?
% ./mvnw quarkus:dev
...
2023-01-31 09:27:25,288 INFO [🐳 .io/postgres:14]] (docker-java-stream--933788147) Starting to pull image
2023-01-31 09:27:55,287 ERROR [🐳 .io/postgres:14]] (testcontainers-pull-watchdog-1) Docker image pull has not made progress in 30s - aborting pull
docker.io had hit a timeout limit. Logging in cleared the limit and now the skeleton project works. It looks like maven is actually using podman compose correctly under the covers.
I am migrating to circleci2.0 and after successful build when tests are executed they are randomly failing with following error messages
/usr/local/go/pkg/tool/linux_amd64/link: signal: killed
/usr/local/go/pkg/tool/linux_amd64/link: flushing $WORK/b462/payment_step_svc.test: write $WORK/b462/svc.test: cannot allocate memory
I used the following config
jobs:
build:
docker:
- image: circleci/golang:latest
- image: rabbitmq:3.5.4
- image: redis
working_directory: /go/src/github.com/soniabhishek/taskrunner
environment:
GOOS: linux
GOARCH: amd64
GOPATH: /go
steps:
- checkout
- run:
name: Get dependencies
command: go get -t -d -v ./...
- run:
name: Build all
command: go build ./...
- run:
name: Test all
command: go test -v ./...
I have tried for many golang versions other than latest like (1.10.3).
Although I found the hack for this but I am not sure why is this happening,
all my tests run when I use CGO_ENABLED=0
Would like to know why is this issue occurring and permanent solution for this
There are two clues here that suggest you are consuming too much memory, and the OS is forcibly killing your "rogue" process. They are:
killed
cannot allocate memory
You can confirm this by getting an SSH session at the end of a failed build, and examining the kill history using dmesg. If it gives you a "sacrifice child" message, then you hit a memory limit so severe that the OS was forced to remove a process from memory.
You have several options. I put them here in the order I would suggest you prefer them:
Reduce your memory consumption by making changes to your Go program
Ask CircleCI to set you up with a larger Docker container (this will be a chargeable option). The default is 4G, I believe 8G and 16G are available
Swap to a Machine executor (presently free of charge, subject to change). This gives you 8G of RAM, but you lose some of the flexibility of the Docker approach (e.g. you have to use one of a few preset base images).
What worked for me in this situation was go test -p 1 to tell Go to run just one compilation at a time.
Without that Go will run the number of CPUs you have, which by default on CircleCI is two.
I'm trying to setup a Docker container to build my java project with maven
I have created my Docker file FROM maven:3.2-jdk-7 and built the image.
when I execute with:
docker run -it --rm --name my-maven-project -v "$PWD":/usr/src/app -v
"$HOME"/.m2:/root/.m2 -w /usr/src/app -v "$HOME"/.ssh:/root/.ssh test
mvn clean package -Dmaven.test.skip=true
It takes about 20 minute to complete.. but if I run the the same mvn command on my host it takes 2minutes
I have tried giving more memory to the container by using
-m 4gb
But it didn't change anything, looking at docker stats the container barely used more than 2G
I'm running all this from OSX
Is there anything I need to do to have a maven finish in a decent time? I very very surprised it takes THAT much when on the host it takes 2minutes..
This what docker stats says after maven has been building for 10 min
CPU: 201.13%
Mem usage / limit : 2.508GiB
MEM % : 62.69%
NET I/O: 3.01kB / 861B
BLOCK I/O: 57.7MB / 2.23MB
PIDS: 38
- EDIT -
It turns out Docker for mac does not play well when using mounted volume.
In order to avoid having to git clone the project inside the container I preferred using using -v "$PWD":/usr/src/app
To test I have directly git cloned the app form within the container and now the build takes a normal amount of time (4minutes)
Note that the git clone took... 6 min!!! instead (1min on host) so in total from git clone to final build it still takes 10min which is ridiculous.
So yea OSX and Docker is a big no no when using mounted volume...
I ran into this same issue using the same docker run syntax as you (docker run -v src:dest). A Maven build that took ~30 seconds on my OSX host was taking ~4 minutes in my container. I didn't solve it entirely, but switching to explicitly use a bind mount took my builds from around 4 minutes down to about 1.5 minutes. This still isn't an acceptable increase in build time for my use case, but it may help someone else. Try switching your docker run command to this:
docker run --name=my-maven-project -it \
--mount type=bind,source="$(pwd)",destination=/usr/src/app,consistency=delegated <docker image name>
NOTE: The consistency option at the very end is only valid on OSX, and has two other values, either of which may be more appropriate for your situation. I tried all three out of curiosity and build times were comparable between the delegated and cached options, meanwhile the consistent option nearly as slow as the way I was doing it before (unsurprisingly). Here's the documentation:
https://docs.docker.com/storage/bind-mounts/
So, unfortunately, despite bind mounts being "very performant," they're still apparently at least twice as slow as a native filesystem when it comes to maven builds, at least on OSX. With luck that will improve as time goes on.
I'm running a spring boot 1.4.3 app in openshift origin 1.3.
It takes more than 20 minutes to bring spring bootup.
the docker base container I'm using is alpine:3.4 with opendk8-jre.
the spring boot embedded container is using default tomcat one. I've installed the haveged and set -Djava.security.egd=file:/dev/./urandom
but if I run the image itself with docker run(I'm not using openshift), it can start up..
any idea why ?
Could it be the case that you don't have a maven proxy setup and are downloading all dependencies?
If it's the case your logs likely show that you are donwloading the same deps over and over.
run this command to see the logs:
oc logs _POD_NAME_
Also, have you tried the same in OpenShift Dev Preview and got similar results?
I have a simple Spring Boot Application, a Spring Cloud Config Server that is going to be run on Openshift 3.1. The problem is that when running on this platform, the application increases its size steadily until it uses up the set up container max memory (512MB), crashing eventually, and making Openshift restart it.
We configure this application on Openshift with a Dockerfile. Deploying it directly on a simple Docker container the application behaves normally. I load-tested it with JMeter and its memory compsumption stays at 256MB, no matter the load.
Could this be an Openshift bug? Is there any solution for this?
Dockerfile:
FROM java:8
RUN curl -H 'Cache-Control: no-cache' -f "http://${APPLICATION-URL}" -o ./app.jar
EXPOSE 8888
ENTRYPOINT java -jar ./app.jar