Welcome! Log In Create A New Profile

Advanced

Resident memory not released

July 29, 2019 11:25AM
Hi all,

We are using the kubernetes nginx-ingress for websocket connections in front of one of our applications. We have added automatic scaling based on the resident memory, as that seems to be a good scaling metric when dealing with persistent connections. But we noticed that the memory seems to never be released, and thus it only scales up and never down.

I've done some testing locally using this dockerfile and nginx.conf with vanilla nginx: https://gist.github.com/fredr/d58f8221b813e4fdcf7bbfc08df30afa and it seems to have the same behaviour.

Starting the docker image, nginx has allocated 211Mb in the resident memory column in htop.
Then I connected 20K websocket connections, memory raised to about 540Mb, and then I disconnecting all the connections, the used memory stays at 540Mb.

If I reconnect all the 20K websocket connections, it seems to reuse the already allocated memory.
So I wounder, is this by design? is it somehow configurable, so that nginx would release this memory? or is it the wrong value to base scaling on?

--
Fredrik Enestad
Subject Author Posted

Resident memory not released

fredr July 29, 2019 11:25AM

Re: Resident memory not released

Maxim Dounin July 29, 2019 01:04PM

Re: Resident memory not released

aledbf July 29, 2019 02:52PM

Re: Resident memory not released

Maxim Dounin July 29, 2019 03:12PM

Re: Resident memory not released

fredr July 30, 2019 10:46AM

Re: Resident memory not released

Peter Booth via nginx August 02, 2019 01:58AM

Re: Resident memory not released

fredr August 05, 2019 07:12AM

Re: Resident memory not released

aledbf August 05, 2019 12:37PM

Re: Resident memory not released

fredr August 06, 2019 03:52AM

Re: Resident memory not released

aledbf August 06, 2019 01:08PM

RE: Resident memory not released

R, Rajkumar (Raj) August 05, 2019 08:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 252
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready