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

Fix k8s memory leak #387

Merged
merged 4 commits into from
May 25, 2016
Merged

Fix k8s memory leak #387

merged 4 commits into from
May 25, 2016

Conversation

emilevauge
Copy link
Member

This PR fixes memory leaks in Kubernetes backend.
/cc @nlf
Fixes #377

@emilevauge
Copy link
Member Author

Waiting feedback from @nlf before merging

@emilevauge emilevauge added this to the 1.0 milestone May 19, 2016
@emilevauge emilevauge force-pushed the fix-k8s-memory-leak branch 2 times, most recently from a39d7ae to 2b50b8f Compare May 19, 2016 20:30
@nlf
Copy link

nlf commented May 19, 2016

LGTM very very significant improvement 👍

@emilevauge
Copy link
Member Author

Hum, I need more time on this...

@errm
Copy link
Contributor

errm commented May 20, 2016

It seems much better, but it still looks like memory usage is growing unbounded, albeit at a much slower rate...

@emilevauge
Copy link
Member Author

I just pushed a new version for testing purpose on docker hub: containous/traefik:k8s

@errm
Copy link
Contributor

errm commented May 20, 2016

Ok just deployed containous/traefik:k8s will let you know what it looks like ...

@nlf
Copy link

nlf commented May 23, 2016

i've got the latest k8s tag deployed too and am monitoring memory growth, i'll report back later today

@errm
Copy link
Contributor

errm commented May 24, 2016

The leak is still there, but much slower. I am seeing the memory usage go from 20MiB to 256MiB in 5 hours, after 256MiB I am killing the process.

It seems that memory is leaking from somewhere in k8s.client#WatchAll as I have a branch where I am watching endpoints rather than pods and replication controllers, and the memory leak is much slower again... as watched events fire far less often.

@emilevauge
Copy link
Member Author

Hi @errm, I can't reproduce your leak on my computer :'(
@nlf do you have the same behavior ?

@nlf
Copy link

nlf commented May 24, 2016

i can't say for sure, our hosting provider had some issues so we had a bunch of services restart from that. if everything stays up ok today i'll report back later

@errm
Copy link
Contributor

errm commented May 24, 2016

@emilevauge I am still seeing the issue, but I these changes are a big improvement so I think it would be good to merge them in. For me the issue is solved when I am running these changes, plus the stuff I am working on to build the backend with endpoints.

I will be able to open a PR with as soon as this is merged...

@emilevauge
Copy link
Member Author

emilevauge commented May 24, 2016

@errm OK ;) Let's merge this one then /cc @vdemeester :)
You could also try to modify the parameter providersThrottleDuration in traefik, as you have a high rate of kubernetes events. By default, it is set to 2s, maybe you could try with 500ms, it could help.

Signed-off-by: Emile Vauge <emile@vauge.com>
Signed-off-by: Emile Vauge <emile@vauge.com>
Signed-off-by: Emile Vauge <emile@vauge.com>
Signed-off-by: Emile Vauge <emile@vauge.com>
@nlf
Copy link

nlf commented May 24, 2016

I tend to agree, it's so significantly better than it was it's worth merging as is to keep things moving forward. For what it's worth, of the 4 instances I'm running it looks like only one of them is leaking at all, and it appears that garbage collection is fighting to keep it under control so the growth is pretty minimal

@vdemeester
Copy link
Contributor

Sounds good to me (based on the comments).
LGTM 🐯

@vdemeester vdemeester merged commit ed3bcc6 into master May 25, 2016
@emilevauge emilevauge deleted the fix-k8s-memory-leak branch June 24, 2016 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

potential memory leak in kubernetes ingress backend
5 participants