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

    How Much Memory Does Your Server Need?

    Scheduled Pinned Locked Moved IT Discussion
    13 Posts 3 Posters 1.4k Views
    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

      Just thought that I would share. This is a real world, production jump box / SSH proxy. It has tuned running which is one of the largest consumers of memory on the system. It also uses filebeat to ship logs to ELK, which is the largest memory consumer on the system. And even with that, while in use, the system uses very, very little memory.

      $ free -m
                    total        used        free      shared  buff/cache   available
      Mem:            490          62         281 
      

      62MB of RAM used while running in production. I've seen it idle as low as 39MB!!

      1 Reply Last reply Reply Quote 2
      • hobbit666H
        hobbit666
        last edited by

        I was going to start a new thread next week about how to monitor and tweak memory for Linux Servers (and possibly Windows)

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

          Simple answer is... shut down everything that you don't use 🙂 For example, our Jump box does not, ever, need to send out emails. So the email daemon is disabled. That shaved off 4MB of RAM not having that loaded into memory. We kept it installed, it takes a whole five seconds to turn it on should it ever be needed. But it is not loaded into memory or using CPU cycles. Makes for a lighter, faster, safer system, just a little ... but every little bit helps.

          hobbit666H 1 Reply Last reply Reply Quote 2
          • hobbit666H
            hobbit666 @scottalanmiller
            last edited by

            @scottalanmiller Yeah being a Linux newbie - I'm not sure what commands to use to see what's running, best way to disable etc.

            But this is for another days discussion 🙂 as I need to sort my Gold Image and Citrix out first lol

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

              Some quick answers for others interested, if you are using CentOS 7 you can use the systemctl command to list out the daemons set to run at boot time. Here is where you would see postfix or httpd set to fire up with the system.

              A common tool to look for big memory users is top. Just run top and select "M" and it will sort the output by the largest memory consumers rather than the largest CPU users (the default view.) If you have a big monitor (or you reduce your font size) you can see dozens of the biggest memory users which generally makes it pretty easy to pick out problem applications and daemons to address or remove.

              If you see things like BASH, SSH and top topping the list, you are already too lean to tune it down 🙂

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

                If you want to run really lean, a good Linux install can get down to around 30MB for a server that is running idle. If you really want, you can get it lower but you have to start removing things that you would normally want on your server, like remote access and the firewall. So realistically you want get much below 55MB without getting a little weird with what you are removing.

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

                  A Jump box is nearly the leanest thing that you can run. I've seen this one come in at 39MB with me logged in which generates a small amount of memory usage from both SSHD and Bash. Had I collected the number without being logged in, it would have been closer to 38MB. Filebeat alone uses another 4MB and logstash that filebeat needs uses another one or two. If filebeat/logstash was removed, the system might idle around 32MB. That was with Postfix still in the mix, so theoretically closer to 28MB is possible with a truly lean CentOS 7 install. Turn off sysstat collection, don't install fail2ban and you can trim it more, but you are then removing things that I would not recommend removing in most cases.

                  1 Reply Last reply Reply Quote 1
                  • A
                    Alex Sage
                    last edited by Alex Sage

                    @scottalanmiller Can you post a htop screenshot?

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

                      Now that the box has been up and running for a bit after a reboot, it cleared down over 10MB of RAM usage!

                      $ free -m
                                    total        used        free      shared  buff/cache   available
                      Mem:            490          51
                      
                      1 Reply Last reply Reply Quote 0
                      • scottalanmillerS
                        scottalanmiller
                        last edited by

                        Here is top:

                        top - 08:53:22 up  3:48,  1 user,  load average: 0.00, 0.01, 0.04
                        Tasks:  65 total,   2 running,  63 sleeping,   0 stopped,   0 zombie
                        %Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
                        KiB Mem :   501908 total,   244080 free,    50712 used,   207116 buff/cache
                        KiB Swap:  1048572 total,  1048572 free,        0 used.   424180 avail Mem 
                        
                          PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                              
                          600 root      20   0  553064  16292   5724 S  0.0  3.2   0:03.11 tuned                                                                                                
                          602 root      20   0  279580  10132   4604 S  0.0  2.0   0:06.68 filebeat                                                                                             
                          368 root      20   0  450116   8440   6604 S  0.0  1.7   0:02.89 NetworkManager                                                                                       
                          385 polkitd   20   0  527448   7828   4524 S  0.0  1.6   0:00.13 polkitd                                                                                              
                         1653 root      20   0  138708   4884   3672 S  0.0  1.0   0:00.08 sshd                                                                                                 
                          607 root      20   0  244008   3916   2572 S  0.0  0.8   0:02.73 logstash-forwar                                                                                      
                            1 root      20   0   41328   3784   2376 S  0.0  0.8   0:01.78 systemd                                                                                              
                          351 root      20   0  287416   3628   2920 S  0.0  0.7   0:00.80 rsyslogd                                                                                             
                          599 root      20   0   82552   3588   2736 S  0.0  0.7   0:00.17 sshd                                                                                                 
                          226 root      20   0   32720   2804   2492 S  0.0  0.6   0:02.41 systemd-journal                                                                                      
                          386 root      20   0   53060   2680   2100 S  0.0  0.5   0:00.00 wpa_supplicant                                                                                       
                         1678 scott     20   0  157552   2136   1524 R  0.3  0.4   0:00.03 top                                                                                                  
                         1656 scott     20   0  115508   2096   1628 S  0.0  0.4   0:00.01 bash                                                                                                 
                         1655 scott     20   0  138708   2092    880 S  0.0  0.4   0:00.00 sshd                                                                                                 
                          355 dbus      20   0   26724   1812   1332 S  0.0  0.4   0:00.44 dbus-daemon                                                                                          
                          257 root      20   0   43028   1748   1296 S  0.0  0.3   0:00.05 systemd-udevd                                                                                        
                          364 root      20   0   26396   1732   1416 S  0.0  0.3   0:00.28 systemd-logind                                                                                       
                          365 avahi     20   0   28108   1688   1392 S  0.0  0.3   0:00.16 avahi-daemon                                                                                         
                          274 root      16  -4   51184   1624   1248 S  0.0  0.3   0:00.17 auditd                                                                                               
                          382 root      20   0  126328   1584    964 S  0.0  0.3   0:00.12 crond                                                                                                
                          402 root      20   0  110032    856    732 S  0.0  0.2   0:00.02 agetty                                                                                               
                          373 avahi     20   0   27984    232      0 S  0.0  0.0   0:00.00 avahi-daemon 
                        
                        1 Reply Last reply Reply Quote 0
                        • scottalanmillerS
                          scottalanmiller
                          last edited by

                          Here is htop

                          0_1461329712482_Screenshot from 2016-04-22 15:54:58.png

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

                            Glances for fun...

                            0_1461329837152_Screenshot from 2016-04-22 15:57:03.png

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

                              And of course, sar -r

                              0_1461329974764_Screenshot from 2016-04-22 15:59:21.png

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