Memory problem, asterisk crashed

Discussion in 'General' started by jervin19801, Aug 6, 2010.

  1. jervin19801

    Feb 9, 2010
    Likes Received:
    I have a problem, memory usage rise up and than server crashes.

    I rent a VPS server and instaled 1.6 elastix.
    In the begining I got 1gb memory but it was always around 70% slowly goes up to 90% and than server is down!
    Asked to rise the memory to 2 gb but situation is same.
    When I run sync; echo 3 > /proc/sys/vm/drop_caches its nothing hapened.
    I add to crone job to run it every hour but nothing the memory stil on 80%.
    Is there another solution?

    Please healp me!

    Thanks a lot.

  2. jervin01

    Aug 5, 2010
    Likes Received:
    Actualy I find this, What YOu think about this?
    I dont know how to make this changes but I will try If somebody say it is OK :)

    Asterisk call recording using Ramdisk
    Asterisk 1.4.22 / Freepbx 2.5 - Call recording using Ramdisk

    Ramdisk is a portion of the computer's physical memory which
    you can use to store files temporarily. Since memory is faster
    than hard disk, ramdisk increases computer performance during
    file operations.

    We can set up asterisk to store ongoing call recordings in
    ramdisk and then move these files to a permanent storage once
    recording has finished.

    In freepbx's general settings, you can assign a directory
    for saving call recordings, "Recording Location:". We'll define
    ramdisk as the destination folder.

    Since ramdisk is a temporary storage, any files located in it
    will be removed when the computer restarts. This is where the
    "Run After Record" comes in handy. We can define a script to
    move the recordings once asterisk has finished writing them.
    Freepbx allows us to push asterisk arguments to the script,
    which we can use to specify recording file names.

    In this example, we set /temp_rec as our recording location.
    This is our ramdisk. Do the following to create our
    temporary storage.

    ;Specify how big is our ramdisk going to be.
    ;Do this in /etc/grub.conf
    ;ramdisk_size is in KB
    ;Here we are configured for 2GB
    title CentOS (2.6.18-128.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 ramdisk_size=2000000
    initrd /initrd-2.6.18-128.el5.img

    ;Put this in rc.local to create ramdisk during bootup
    /sbin/mke2fs -m 0 /dev/ram0
    /bin/mount /dev/ram0 /temp_rec
    /bin/mkdir /temp_rec/monitor
    /bin/mkdir /temp_rec/system
    /bin/mkdir /temp_rec/tmp
    /bin/chown -R asterisk.asterisk /temp_rec
    ;For more infor on ramdisk:

    ;Link asterisk's default folders to our ramdisk
    /bin/ln -s /temp_rec/system /var/spool/asterisk
    /bin/ln -s /temp_rec/tmp /var/spool/asterisk
    /bin/ln -s /temp_rec/monitor /var/spool/asterisk

    ;Create script
    ;nfs_disk is a nfs server
    #! /bin/bash
    /bin/mv $1/$2.$3 /nfs_disk

    ;Now the general settings should look like this:
    Recording location:

    Run after record:
    /var/spool/asterisk/scripts/ ^{MIXMON_DIR} ^{CALLFILENAME} ^{MIXMON_FORMAT}

    ;create nfs entries in fstab
    ; is our nfs server /nfs_disk nfs rw,soft,intr,bg,nolock,rsize=8192,wsize=8192,udp 0 0

    Below are the figures and specifications I used to
    test everything we've discussed.

    Asterisk server:
    Quad Xeon 2.40GHz
    4GB RAM

    Pjsip / Pjsua server - for emulating (multiple calls) 60 extensions
    logged into asterisk's queue. You can set them to auto-answer,
    automatically play audio and disconnect after 10 minutes.

    Vicidial server - for conducting 60 simultaneous calls to asterisk
    (with audio playing) and redialing each time pjsip extensions
    disconnect (10 minutes). Vicidial made 500 calls during the test.

    Asterisk with 60 simultaneous incoming calls being recorded for 10
    minutes at any given time. Finishing off with 500 calls in total.

    I used sync in crontab to clear the memory cache from
    time to time. But it is best to put in additional physical
    RAM if recording eats up more memory.

    */30 * * * * /bin/sync; echo 3 > /proc/sys/vm/drop_caches

Share This Page