View Full Version : 30 second request: how much RAM your sshd uses
UKst3m8ffsysBoy
15th March 2008, 02:22 AM
This will only take 30 seconds, so please can 20 or 30 folk help out. I'll publish a summary to everyone afterwards.
If you have a fedora x86_64 server running sshd... just run top and report the memory value in the VIRT column
Eg:
FC 6 VIRT = 12700
Thanks!
I have 5 or 6 hosted servers running various FC4 or FC6.
The x86_64 installs show in 'top' that all apps use Lots more memory.
5 or 10 times the memory! Even for 'top' and 'sshd' - see data below.
I've googled for hours, but no published data on actual memory usage.
Some folks say not to worry if your RAM is used, the kernel 'should do that' - but I can't believe that the 64bit kernel needs to give 80M to 'sshd', or 12M to 'top'....! when the 32bit kernel doesn't.
Question 1: can anyone using x86_64 builds of FC4 or FC6 check how much memory their top and sshd are running.
Question 2: if others do not have this problem - how do I fix it? Is there something the ISP did in first building the 64bit servers, that i can correct? Or must I reinstall? or...
Thanks in advance!!
:)
-------------------------------------------------------------------------------
This is how much memory 'top' itself says it uses: (using VIRT column from top)
FC4 2,012
FC6 2,204
FC4 x86_64 7,300
FC6 x86_64 12,700
sshd uses:
FC4 7096
FC6 8016
FC4 x86_64 43,400
FC6 x86_64 82,400
All CPus checked with
less /proc/cpuinfo
and are:
AMD Athlon(tm)
64 X2 Dual Core Processor
4400, or 4200
Linux kernels
----------------
no special builds, just Fedora supplied. 2.6.x
64bit: 2.6.17 and .20
non-64: 2.6. 16 and .18 and .22
Thetargos
15th March 2008, 12:50 PM
64-bit data types are twice as big as 32-bit ones, resulting in twice the memory required hold these twice as big data types (roughly, some times, as you have noted, more). You really shouldn't worry much, epecially if you have the memory to spare (if not, consider reverting to 32-bits or adding more RAM, which ever is more cost-efficient in your environment). The Linux kernel not only is very efficient with its memory management, it also establishes a number of buffers and caches for programs, and whenver an application or service requires more memory it will gladly give it to it, closing some buffers in the process. The real benefits of a 64-bit platform over a 32-bit platform is the increased precision in mathematical operations, particularly floating point math (and bigger integers). Lots of applications benefit from this, but this also means that these applications will require more RAM. Not only 64-bit applications that benefit from 64-bit computing will use more RAM, but any 64-bit bianary will. When used on servers, it greatly depends on the task of the server if it really benefits from a 64-bit platform or not (for examle, an SSL or encryption server will benefit greatly, where as a mail server may not [not taking into account spam filters, though, which may actually benefit from 64-bit computing], etc). So even if the hardware is capable of 64-bit computing, some tmes it is not the best choice.
UKst3m8ffsysBoy
15th March 2008, 01:16 PM
Thanks Thetargos - but how much do 'top' and 'sshd' consume on your 64 bit systems?
I have seen the 64bt systems slow down as they swap to disk due to excess memory usage.
I find it hard to believe that there is nothing wrong on my systems, when they take 40 or 80MB for sshd, when 32bit only needs 8M.
But without data from other 64bit users, I'm in the dark as to whether my experience is normal - or abnormal.
Please 64bit folks, do run top and tell me what you see!
Thanks
neil2211_1
15th March 2008, 11:46 PM
Here are my stats from a 64-bit machine:
The VIRT for top itself is 14736 and the VIRT for sshd is 56244
$ cat /proc/cpuinfo
[...]
model name : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
[...]
$ uname -a
Linux hostname 2.6.24.3-12.fc8 #1 SMP Tue Feb 26 14:21:30 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
klaasjan
18th March 2008, 03:03 PM
-------------------------------------------------------------------------------
This is how much memory 'top' itself says it uses: (using VIRT column from top)
The "virt" column only gives information about how much memory an application has requested, not how much it's using. The "RSS" (resident size) column will give you a more accurate idea how much of your memory is in use.
UKst3m8ffsysBoy
19th March 2008, 12:40 AM
The "virt" column only gives information about how much memory an application has requested, not how much it's using. The "RSS" (resident size) column will give you a more accurate idea how much of your memory is in use.
Thanks Klaasjan - but what memory do *your* 64bit systems use for sshd and top ?
Please, anyone reading this, tell me the VIRT values from top for your sshd and top usage !! I still don't know if my boxes are 'normal' or not - and hours googling have not helped so far... I need your VIRT info! thanks.
Klassjan, what you've said is 100% true (man top : see below)- but does not help my question. Why should the fact that the extra 400% memory that 64bit needs (it seems so far) is swapped to disk, make anyone happy? Swapping it to disk just puts my machine nearer to a swapping slowdown. I want it not to need 400% more!
I do understand from the simple '64 = 32 x 2' theory, that 64bit may, in the worst case, need 2x the memory of 32bit.
I would hope (guess) that in many cases, 2x memory is not needed because the compiler can do clever things like pack 2 seperate 32bit lines into 1 64bit one: for at least some of the code.
But why does top and sshd need 5x the memory, on >4 of my 64bit boxes? And on Neil's, who posted here.
What possible use is there to top and sshd to use that memory?
There is no gain to be had from caching data for them, that I can think off.
VIRT RES SWAP CODE DATA SHR COMMAND
42164 1916 39m 332 668 1212 sshd
And top here shows that sshd has 42M of memory, 39M has been swapped: and there's only 668k data and 332 of code... so what is the 39M doing? when 32bit Fedora only needs 8M swap+resident total?
DJ
# man top
VIRT -- Virtual Image (kb)
The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out.
VIRT = SWAP + RES.
p: SWAP -- Swapped size (kb)
The swapped out portion of a taskâs total virtual memory image.
q: RES -- Resident size (kb)
The non-swapped physical memory a task has used.
Thetargos
19th March 2008, 08:02 AM
Usually on my systems sshd doesn't take up more than 1.1Mb of RAM, but that's without any actual connection, maybe what you are seeing is the sshd daemon busy with multiple connections?
LordMorgul
19th March 2008, 11:48 AM
After stopping and restarting ssh on both my i686 and x86_64 machines, with no connections I see:
x64: VIRT 58612 RES 1172
x86: VIRT 7176 RES 1024
So yes there is a difference. If I'm not mistaken.. 64kib pages are in use for x86_64 while 4kib pages are being used for x86. That could make up part of this difference.
UKst3m8ffsysBoy
3rd April 2008, 10:14 PM
LordMogul - can you expand on your 'pages' idea? 'page' can mean many things -what exactly did you mean?
You say 64k vs 4k - so that would imply 16 times more memory - i've not seen a ratio that bad... but have seen ratios up towards 10 times or so.
After stopping and restarting ssh on both my i686 and x86_64 machines, with no connections I see:
x64: VIRT 58612 RES 1172
x86: VIRT 7176 RES 1024
So yes there is a difference. If I'm not mistaken.. 64kib pages are in use for x86_64 while 4kib pages are being used for x86. That could make up part of this difference.
LordMorgul
3rd April 2008, 10:42 PM
The kernel page size is the minimum block of memory the application requests/receives and is the minimum size block that gets swapped to disk. If an application needs to map a file into memory (for instance a library binary file) it will load it into a page, or multiple pages, but if the file is much smaller than 64k (lets assume a 40k binary) then it needs to use one whole page but wastes some of that memory (here 24k unused). With the 4k kernel page size it will load that file across 10 pages, each using only 4k, and will leave none unused/wasted.
The cost of using larger pages is some wasted memory, the benefit is fewer pages to swap in/out of memory to disk in virtual memory operations and a smaller overall page list (fewer pages). The cost will not be a constant 16 times more memory, it will vary but will generally be lower because most objects mapped into memory a much bigger than 4k and end up using multiple pages.
LordMorgul
3rd April 2008, 10:46 PM
Note also that when something in compiled in 64bit code, some numbers actually needed to be 64bit and others did not, so there is some inherent wasted space due simply to oversized fields as well. Its like compiling all your 32bit code forcing integers to be represented by longs (you waste physical memory size).
UKst3m8ffsysBoy
4th April 2008, 11:59 PM
I'm asking for a bunch of you to post here - just run 'top' and report the VIRT memory column that it shows for itself, and for sshd.
The reason - to understand if/how/why x86_64 uses ~5 or 10 more memory than 32bit.
As a template, here are some values from my system
__top uses:
FC 32/64 Memory:
-- -- ---
FC4 32 2,012
FC6 32 2,204
FC4 64 7,300
FC6 64 12,700
__sshd uses:
FC4 32 7096
FC6 32 8016
FC4 64 43,400
FC6 64 82,400
Thanks everyone!
Background - see http://forums.fedoraforum.org/showthread.php?t=183615
Seve
5th April 2008, 12:03 AM
( Threads Merged )
leigh123linux
22nd April 2008, 03:12 PM
Thread renamed !
Thetargos
22nd April 2008, 06:14 PM
Fedora 8, 64-bit on a 2Gb RAM system, sshd uses only 1168 kbytes. That is with no actual connections.
Edit
Methodology used:
ps aux | grep sshd
to find out the PID, which is the first number after the UID the program is run under (it also says the RES memory).
top -p $SSHD_PID
to monitor sshd's memory fingerprint during a period of time.
By the way I measure memory fingerprint of the program using RES instead of VIRT as VIRT also refers to other dynamic libraries which may be in use by other programs, and as such not necessarily being used entirely by sshd, and incurs in misleading numbers. RES is the amount of memory requested to the kernel by the process itself (AFAIK)
Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.