On Apr 20, 2008 at 20:04, William Zhang <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> I am a newbie to the SIP Express Router and the project I am currently
> working on requires me to port SER to a MIPS embedded system with
> limited memory space.  So the code size and data memory size are my
> primary concerns.

ser already works and compiles for MIPS, so you'll need only to optimize
it for lower memory usage.

Example cross-compile for openwrt (gcc 3.4.4):

make ARCH=mips2 CC=${OPENWRT}/staging_dir_mipsel/bin/mipsel-linux-gcc \
OS=linux OSREL=2.4.35  CC_EXTRA_OPTS=-Os extra_defs=-DNO_DEBUG

After runing strip on it:
ls -l ser
-rwxr-xr-x 1 andrei andrei 526652 Apr 23 14:10 ser

On x86, compiling with similar options, gcc 4.2.3 and stripping, I get:
-rwxr-xr-x 1 andrei andrei 379876 Apr 23 14:25 ser


(for ser 0.9.7, 2.0 & 2.1 are ~ 1Mb for mipsel/gcc 3.4.4 and ~640k
x86/gcc 4.2.3)


> Since I am still having some issue with my MIPS cross compilation, I
> just worked the SER 0.9.6 on my SUSE PC. With all the default compiler
> option but removing the debug info (without the -g option) and i386
> release target, the SER
> is about 490KB in code size (the .text section in the map file).  I
> disabled the TCP, IPV6 and UDP MULTICAST support, the code size
> decreased to 423KB.  The SER website mentions that footprint size:
> 300k core, all common modules
> (optional) up to 630k (http://www.iptel.org/ser).  Am I missing
> something here or maybe the website is not up to date with the
> footprint?

It's not up to date (IIRC this was ser 0.8.10).

> I only need the basic SER with authentication and PSNT
> gateway support. I loaded these moduels:
> mysql.so, sl.so, tm.so, rr.so, maxfwd.so, usrloc.so, registrar.so,
> auth.so, auth_db.so, uri.so, uri_db.so, domain.so, avpops.so and
> permissions.so. And these modules adds up to 432KB with tm.so as the
> biggest one(200KB). Is there any
> way to further reduce code size for the core and modules?

Compile with -Os (CC_EXTRA_OPTS=-Os to the make command line), 
 extra_defs=-DNO_DEBUG.
There are lots of othe different defines you can play with (like turning
down support for poll methods you don't use), but  I don't remember all
of them.
> 
> Of course, this is only the size for PC platform. I am hoping the MIPS
> should not differ too much.  If anybody compile SER in MIPS, could you
> let me know what the code size is?  Even for IPAQ compile result,  I
> also would like to know it.

It's bigger (see above) :-( 
Maybe a newer gcc would help.

> 
> As for the data memory, it seems the SER use the 1MB pool memory as
> default for dynamic memory allocation and 32MB shared memory.  If I
> only need to support 3600 call per hour, about 1 call per second, and
> maximum 80 concurrent calls,

For 1 cps with default timeouts you need ~200k. If you want to plan for
a DOS: 2.5Mb - 5Mb.
For maximum 80 concurent calls 1.6Mb.
(rounding up transaction usage to 20k, in reality it's <10k on a 32 bit
cpu and a simple no-avps config)

Note however that there is some memory needed for internal structures
(hashes a.s.o) so you can't probably start ser with less then 2Mb shared
memory (at least not 2.1).
Try starting with 3Mb (ser -m 3) if you use 0.9.7 or 4 Mb if you use 2.0
or 2.1.

There are also some compile option that could reduce dramatically the
memory usage. For example the size of various hashes (tm hash, dns
cache, blacklists a..s.o). 
I always wanted to introduce a make target or option for embedded
systems, that would minimize memory usage at the cost of performance,
but I never got to doing it :-(

> is the default memory allocation too large? How far can I reduce from
> the default? Is there way I can monitor the memory usage for an active
> call?

You can reduce default shared memory usage by starting ser with a
different  value: ser -m <value_in_MB>.
The pool memory can be reduced only by modifying config.h
PKG_MEM_POOL_SIZE and re-compiling. You could porbably get away with 512
Kb of pkg mem. (or maybe even less). Just watch out the log for out of
memory errors.

You can't monitor memory usage per call (in fact ser doesn't even have a
"call" notion). On 2.0 or 2.1 you could see the current shared memory
usage using sercmd: sercmd core.shmmem.
For 0.9.x you could try looking at top output for the "RES" value, or
you could use a high log level and look at the log output on exit or
after kill -SIGUSR1 <pid_of_ser>.


Andrei
_______________________________________________
Serdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/serdev

Reply via email to