On Montag, 9. November 2009, Robin Vleij wrote:
do you
experience any problems in your setup when you use a reasonable
SHM mem size? In my experience the size of the SHM memory (as displayed
I've had problems finding a "reasonable" shm mem size. :) Standard is
like 32MB, which runs out quickly when customers do "funny stuff" (read:
loops). Now I'm compiling with #define SHM_MEM_SIZE 4*32. 128MB should
be enough to hold pretty long.
Hi Robin,
btw, there is no need to re-compile the server just to change this setting,
its a normal daemon binary parameter. 128 MB should be really fine, given the
load you quoted.
So there's no immediate memory problem or
crashes (when it's full, it gets errors and stops processing traffic the
right way). But right now for example, after a "funny" customer, I'm
seeing over 40mb per child in top (16 children). That won't go down
anymore, so we'll have to see how long it holds.
What do you suggest for SHM sizes?
With today memory sizes/ prizes you could use for example 512 MB, which should
give you plenty of room even in really abnormal load conditions. And as its
shared, you'll have still plenty of room for e.g. the database.
machine has
been completely passive over a longer time, it will not
reclaim this memory. On a certain test system for example there is one
process that has 11MB SHM at the moment, even if its completely idle.
OK. We often run very long on 10-20MB per process (all processes have
about the same, at least the children that process UDP), but like today
when someone has a problem and it becomes sip-spaghetti it jumps up to
40MB and then continues to slowly rise from there. Doesn't feel good to
be able to hit some kind of roof with the same traffic load.
You mentioned the the loops a few times, normally they should be pretty fast
detected by max forward counter checks and additionally by diversion header
checks?
If you've
a real memory leak in shared memory then after a certain time
interval the server will report memory allocation errors. Otherwise i
don't think its something to worry about.
It does, if I don't make the limit higher. So say that I'm running on
32, then if I would hit that after some weeks uptime it would start
reporting memory allocation errors in different parts of my config and
stop doing important stuff. I also reproduced this assigning a small
amount to a dev machine and then sending 20cps to the machine.
On a test machine I have like 4 processes all using 600kb or so, then
after 20 calls it'll go up to something like
31409 root 15 0 94672 1936 1052 R 0.0 0.7 0:00.00 kamailio
31408 root 15 0 94784 3072 2068 S 0.0 1.2 0:00.00 kamailio
31407 root 15 0 94784 3072 2068 S 0.0 1.2 0:00.00 kamailio
31406 root 25 0 94672 5428 4556 S 0.0 2.1 0:00.02 kamailio
And go back in size only a little after 15-20 minutes or so (often a bit
faster is load is low).
With the memory debugging you could dump all the allocations during runtime,
but they are a bit hard to read for a non-developer. But this way you could
reproduce "call by call" how your server behave and how the situation
develops.
If this is a leak, it'll be almost impossible to
find. I can't run
production with memlog or debug on, and in dev it's quite hard to
reproduce it seems. Not sure what to expect. :)
If you'd have a leak in a common used code path, then you'll run out of memory
pretty fast, like in a few days. If your servers are stable (like some weeks
or month) with the setting you use at the moment, i don't think there is much
to worry.
Regards,
Henning