Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entrypoint config over-allocates memory #41

Closed
0r0misElda opened this issue Mar 28, 2019 · 24 comments
Closed

Entrypoint config over-allocates memory #41

0r0misElda opened this issue Mar 28, 2019 · 24 comments
Assignees
Labels

Comments

@0r0misElda
Copy link

0r0misElda commented Mar 28, 2019

In: https://github.com/ryansch/docker-unifi-rpi/blob/master/5.10/Dockerfile.arm64v8
Line: ENTRYPOINT ["/usr/bin/java", "-Xmx1024M", "-jar", "/usr/lib/unifi/lib/ace.jar"]
Specifies: Max of 1024M for JVM use within the container. However, that is the max available on the Pi. Line should be modified to use a max of say 500M-700M, to allow enough for the base OS to continue to operate while the container is running in Docker.

Environment:
Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-1032-raspi2 aarch64)
Docker version 18.09.3, build 774a1f4
Container version ryansch/unifi-rpi:5.10.20-arm64v8
Rasberry Pi Model 3B

@ryansch
Copy link
Owner

ryansch commented Apr 7, 2019

Agreed. I'll give this a whirl.

@ryansch ryansch self-assigned this Apr 7, 2019
@0r0misElda
Copy link
Author

Does the Garbage Collection for UniFi work sufficiently well enough to handle the 500M of Memory?

@ryansch
Copy link
Owner

ryansch commented Apr 9, 2019

That's exactly what I was wondering. I'm not sure if we've been hitting swap or not.

@0r0misElda
Copy link
Author

I also neglected to mention my current workaround for this issue... apologies.

Here's my docker run command:
sudo docker run -d --net='host' --restart=always -e TZ='America/Chicago' -e JAVA_OPTIONS='-Xmx500m' -v ~/unifi:/var/lib/unifi --name unifi ryansch/unifi-rpi:5.10.20-arm64v8

My current hardware, OS, and kernel config doesn't allow me to specify container memory --memory="500m" or swap --memory-swap="2g" in the docker run command. So, this was the next best way to do it without a direct edit of the Dockerfile.

@halindrome
Copy link

FWIW having the high heap limit doesn't seem to cause a problem on my various RPi.

@0r0misElda
Copy link
Author

FWIW having the high heap limit doesn't seem to cause a problem on my various RPi.

@halindrome, What OS and version are you running?

@ryansch
Copy link
Owner

ryansch commented Apr 23, 2019

I also haven't had a problem which is the biggest reason I've never made this change.

@0r0misElda
Copy link
Author

UniFi Controller is still going OOM, even with the new settings specified. I'm having trouble understanding why others are not experiencing similar issues. So, it begs the question: What am I doing differently than everyone else not experiencing this issue? Is it OS? Must I abandon Ubuntu? Appreciate any feedback.

@halindrome
Copy link

I am actually hitting high memory on the stock compose configuration now (finally). So yes, this 1024 limit is a problem for me too. It just took a while for the memory utilization to get up there.

@ryansch
Copy link
Owner

ryansch commented May 30, 2019

Ok I'll take a crack at this.

@ryansch ryansch added the bug label Jun 1, 2019
@ryansch
Copy link
Owner

ryansch commented Jun 1, 2019

@0r0misElda @halindrome Please have a look at #43

You can pull ryansch/unifi-rpi:5.10.24.test to test these changes.

@ryansch
Copy link
Owner

ryansch commented Jun 1, 2019

I'm finding that I can't start the container with only 512M of heap space for the JVM.

@ryansch
Copy link
Owner

ryansch commented Jun 1, 2019

Oops: I built tini for amd64 for all platforms.

@ryansch
Copy link
Owner

ryansch commented Jun 1, 2019

Fixed.

@ryansch
Copy link
Owner

ryansch commented Jun 2, 2019

I think it's working with 512MB heap space. Please test and report back.

@0r0misElda
Copy link
Author

I'll have some time, tonight, to tinker with this again. Been away, fishing, conferences etc. I'll report back after testing it out a few days. Usually doesn't take it more than 2-3 days to go OOM, if I let it sit.

@0r0misElda
Copy link
Author

0r0misElda commented Jun 24, 2019

2019-06-24_12-48-29
Been running for 70 hours now, without going OOM and crashing my Pi. I'll continue to monitor the situation and report back. I'd be curious to know if anyone else has tried this build.

EDIT: Forgot to include a screenshot for inquiring minds.

@ryansch
Copy link
Owner

ryansch commented Jun 25, 2019

@0r0misElda That's excellent! Did you set JAVA_OPTS or did you leave it at the default?

@0r0misElda
Copy link
Author

@ryansch So, I spoke too soon. Sometime between my update yesterday, and just now, the Pi went OOM and I can't ssh into it, nor is it showing as available from the cloud.

I didn't make any modifications for the start of the container. So, to be clear, no -e JAVA_OPTIONS='-Xmx500m' was used.

So, this seems to play like previous attempts. Anytime after the 48-72 hour mark, it can go OOM.

@ryansch
Copy link
Owner

ryansch commented Jul 24, 2019

I've merged #43 to make it easier to find good values for Xmx.

@ryansch
Copy link
Owner

ryansch commented Jul 24, 2019

@0r0misElda Do you have anything else running on that box?

@0r0misElda
Copy link
Author

@ryansch No, nothing else running on the box besides Docker and the UC container. I have the parts for my RPi 4 w/ 4GB RAM here now. I'm hoping to have it put together and in service soon. I think I'm just going to abandon the RPi3 for a UC. I appreciate the effort put forth trying to get past this issue.

@ryansch
Copy link
Owner

ryansch commented Jul 17, 2020

We've been running with the 512MB default for about a year. I'm going to go ahead and close this.

@ryansch ryansch closed this as completed Jul 17, 2020
@halindrome
Copy link

halindrome commented Jul 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants