[OpenSIPS-Users] Memory Leak - runtime flags?
Ben Newlin
Ben.Newlin at genesys.com
Sat Nov 30 10:45:14 EST 2019
Callum,
It’s my understanding that OpenSIPS does not release memory back to the OS, but it also pre-allocates all memory at startup into its private pool and then allocates from that internally. Normally shared memory should be significantly higher than package memory. For reference, on our system we run with “-m 1024 -M 64” and that is sufficient for us to process very high traffic volume. We don’t do registration though, so that may affect the sizes you need.
You are setting your package memory size to 4G, so that will allocate 4G memory for every package (process) that loads and then 2G for shared memory. That will use up all the memory on your machine extremely quickly for sure. The statistics you provided seem like the memory increase is consistent with higher traffic levels on the second reading. You can see in your case that all of your “pkmem” processes have an extremely high amount of free memory (~3GB!). But that memory is still allocated from the OS, so you are instructing OpenSIPS to allocate much more than your system memory right at startup.
Your shared memory also has just under 2GB free, so you have a lot of headroom there too. Since OpenSIPS pre-allocates, the amount of memory being used by the system overall should be fairly steady; if it is continuously increasing that implies a leak somewhere. IIRC there are a few processes/modules/commands in OpenSIPS or libraries it uses that do allocate memory directly from the system and not from OpenSIPS’ pool. You may need to investigate some of those to find out where your memory is going, or look at other processes/daemons you have running that could be using that memory.
Ben Newlin
From: Users <users-bounces at lists.opensips.org> on behalf of Callum Guy <callum.guy at x-on.co.uk>
Reply-To: OpenSIPS users mailling list <users at lists.opensips.org>
Date: Friday, November 29, 2019 at 10:57 AM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: [OpenSIPS-Users] Memory Leak - runtime flags?
Hi All,
I have recently deployed a new registrar and have been seeing a gradual increase in the memory footprint - enough that I'm having to expand the RAM (its virtualised) to ensure it doesn't run out.
You can see a diff of the statistics collected last night at 11pm and today at 3pm here: https://gist.github.com/spacetourist/2103503674e134bd598c7f1e3a82674c/revisions<https://gist.github.com/spacetourist/2103503674e134bd598c7f1e3a82674c/revisions>
Processes 5-9 are my UDP SIP receiver threads (autoscaled down from an initial footprint of 20 threads).
Using 3.0.1 on CentOS 7 8GB RAM (soon to be 32GB!). Currently OpenSIPs is using all the RAM (minus OS usage) and 2GB of swap. Trying to use dialog and dr clustering if that is significant. Alos have NAT pings configured for all registrations (4000 at time of writing).
I am using runtime configuration flags of "-m 2048 -M 4096" and am concerned that these were (way) too high, I think I've misinterpreted their meaning during initial setup. Is this a ridiculous setting for my environment? Is it just as simple as OpenSIPs being greedy with the memory such that it doesn't bother to free anything while each process free space remaining? Should my -M value * max number of processes fit into my RAM? I guess with an 8GB system that would mean dropping this to "-M 256"?
I've done some research into the issue however I haven't found anything else that would be an obvious target so wondered if the community might have some ideas of where I can begin investigations.
Many thanks,
Callum
[Image removed by sender.]
0333 332 0000 | www.x-on.co.uk<http://www.x-on.co.uk> | [Image removed by sender.] <https://www.linkedin.com/company/x-on> [Image removed by sender.] <https://www.facebook.com/XonTel> [Image removed by sender.] <https://twitter.com/xonuk>
X-on is a trading name of Storacall Technology Ltd a limited company registered in England and Wales.
Registered Office : Avaland House, 110 London Road, Apsley, Hemel Hempstead, Herts, HP3 9SD. Company Registration No. 2578478.
The information in this e-mail is confidential and for use by the addressee(s) only. If you are not the intended recipient, please notify X-on immediately on +44(0)333 332 0000 and delete the
message from your computer. If you are not a named addressee you must not use, disclose, disseminate, distribute, copy, print or reply to this email. Views or opinions expressed by an individual
within this email may not necessarily reflect the views of X-on or its associated companies. Although X-on routinely screens for viruses, addressees should scan this email and any attachments
for viruses. X-on makes no representation or warranty as to the absence of viruses in this email or any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20191130/4d864714/attachment-0001.html>
More information about the Users
mailing list