ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Reducing Memory Consumption in Elastix 2

    IT Discussion
    elastix elastix 2.4 elastix 2.5 centos 5 asterisk
    2
    6
    2.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      If you are running an Elastix 2 install, often you do so on very small systems and need to trim memory usage. I used to have a guide to this on my personal tech site which I've since taken down so am replicating the info here as best as I can...

      The biggest thing to modify is HTTPD settings as these tend to use the most memory over time. Some changes that I make include:

      <IfModule prefork.c>
      StartServers       2
      MinSpareServers    2
      MaxSpareServers    6 
      ServerLimit      128
      MaxClients       128
      MaxRequestsPerChild  4000
      </IfModule>
      
      <IfModule worker.c>
      StartServers         2
      MaxClients         120
      MinSpareThreads     20
      MaxSpareThreads     65 
      ThreadsPerChild     25
       MaxRequestsPerChild  0
      </IfModule>
      

      Daemons that are often enabled but should probably be disabled:

      • cyrus-imapd
      • hylafax (if not in use, of course)
      • iscsi
      • iscsid
      • kudzu
      • lvm2-monitor
      • mailman
      • netfs
      • openfire
      • postfix (only if you do not send emails from the system)
      • psacct
      • vsftpd
      1 Reply Last reply Reply Quote 1
      • NetworkNerdN
        NetworkNerd
        last edited by

        I used to have that article bookmarked. Apparently it is time to edit the location for the bookmark.

        scottalanmillerS 1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller @NetworkNerd
          last edited by

          @NetworkNerd said:

          I used to have that article bookmarked. Apparently it is time to edit the location for the bookmark.

          Me too and now... it's gone.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by

            Can you tell if I missed anything?

            NetworkNerdN 1 Reply Last reply Reply Quote 0
            • NetworkNerdN
              NetworkNerd @scottalanmiller
              last edited by

              @scottalanmiller said:

              Can you tell if I missed anything?

              I found the help desk ticket I created where I applied the steps in your article, but all I did was leave the link to the article and say I made the changes. Shame on me for not documenting the specifics. I feel like there is more to it but cannot tell you what it is. Maybe @FiyaFly remembers.

              1 Reply Last reply Reply Quote 2
              • scottalanmillerS
                scottalanmiller
                last edited by

                Long ago I had an article on this on my own blog but that is no longer up, so I am copying it here...

                https://web.archive.org/web/20150221062029/http://www.scottalanmiller.com/linux/2012/09/02/improving-elastix-memory-usage/


                The default installation of Elastix has more services running than are typically needed or desired on a PBX. These services eat far more memory that is necessary and can very easily be cleaned up to improve memory utilization.

                First we will stop a series of unnecessary services from starting at boot time (this will disable shared storage, local email handling, new hardware detection, etc. so be aware that this does stop some things but any service that proves to be needed is trivial to re-enable.)

                chkconfig nfslock off
                chkconfig cyrus-imapd off
                chkconfig iscsi off
                chkconfig iscsid off
                chkconfig netfs off
                chkconfig kudzu off
                

                Further, if your system is like mine you likely use the web server very lightly but will find that the default configuration of Apache is set to spawn, by default, eight processes. This is far too many for a normal deployment. Each process uses memory. For an average deployment of Elastix, three is more than enough. You need only raise this number if web performance suffers. This will not impact telephony performance regardless.

                In the file /etc/httpd/conf/httpd.conf we need to edit the section:

                <IfModule prefork.c>
                StartServers       2
                MinSpareServers    2
                MaxSpareServers   8
                ServerLimit      256
                MaxClients       256
                MaxRequestsPerChild  4000
                </IfModule>
                

                to something more like this:

                <IfModule prefork.c>
                StartServers       3
                MinSpareServers    2
                MaxSpareServers   10
                ServerLimit      256
                MaxClients       256
                MaxRequestsPerChild  4000
                </IfModule>
                

                You can wait for the system to reboot or restart Apache manually:

                service httpd restart
                

                And finally, to control swapping activity on the box, assuming that you want to avoid swapping when unnecessary, which I do because my box is virtualized, simply add this line on to /etc/sysctl.conf:

                vm.swappiness = 10
                

                You’ll want to test that number carefully. A setting of “10” is quite standard for virtualized systems. The default is “60”. For a physical deployment the higher value is likely better as it allows CentOS to make better decisions about how to utilize memory for maximum throughput. But on a virtualized system we really want to avoid, typically, any additional contention at the storage IO layer.
                [Testing on Elastix 2.0 and 2.3]

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post