View Full Version : [Solved] Memory Usage when Playing files from Samba or NFS
sticf
03-17-2008, 04:47 PM
I did some searches but I did not see anything that helped me on this topic. I am a newbie when it comes to PC-BSD but I have to say overall I am very impressed with the OS as it comes out of the box. I do not know if this is expected behavior but here is my problem:
Version: 1.5 (amd64)
HW: Available on request
I have the OS installed and running fine on a headless box. On the BSD box I have all my music/video files. I mount my home directory on the BSD box via either Samba or NFS from my Windows Box. When I am playing music/video on my Windows box from the BSD share I see the memory usage continually rising on the BSD box (using ksysguard and viewing it via a VNC session). After many hours of this the BSD box eventually gets to a point where when I start/restart my VNCserver it locks up. I can no longer even SSH to the box or get a prompt to return from a existing SSH session.
Other Notes:
-If I stop playing the files the memory usage becomes stable (no longer growing but does not go down).
-I started by using SMB but after I saw the memory usage growing I switched to NFS.
-Memory usage seems be grow faster with SMB than NFS.
-When I switched to NFS I killed Samba Server.
Please let me know if this was put int he wrong forum. Also thanks in advance for any help.
--sticf
--Edit to add some details.
pheet
03-17-2008, 07:06 PM
My experience of Samaba and NFS is running them on a headless FreeBSD 6.0 box on an old PII:
Mem: 22M Active, 50M Inact, 33M Wired, 3112K Cache, 22M Buf, 9072K Free
Swap: 1024M Total, 1024M Free
(and this is with webmin, sshd and a few other things running)
I've had absolutely no problems, ic. memory usage.
-When I switched to NFS I killed Samba Server.
Hmm, I run NFS and Samba, serving identical folders/files, and haven't had any issues. :?
The thing is PCBSD is a desktop orientated version of FreeBSD, for servers it's best to install plain vanilla FreeBSD - e.g. my file server isn't running X, KDE or anything else unneccessary.
It's possible the problem is KDE (KIOSlaves ?), or X, or a bug just on amd64. The problem is, that it's hard to diagnose the cause, and one is unlikly to find much existing releveant documentation because most people running Samba servers aren't running X or a desktop environment (e.g. KDE) on the same machine.
You can try to determine the cause by a bit of trial and (a lot of) error.
Reboot the samba server. Don't log in or use VNC. SSH in, and use top to monitor the memory usage instead of using Ksysguard. Play music from a windows client, see what happens.
If there's still problems, you can try going through the documentation on Samba and file tuning the smb.conf file for number of open files, caching etc. Try disabling X from starting on boot. Google for problems/bugs with Samba and/or BSD memory usuage with the amd64 platform.
Good luck!
BTW, the version of FreeBSD that PCBSD is based on is FreeBSD 6.3-RELEASE-p - might be useful to know.
sticf
03-17-2008, 09:24 PM
Hmm, I run NFS and Samba, serving identical folders/files, and haven't had any issues. :?
I should have been a bit more clear. I purposefully killed the Samba Server. I did that just so I could eliminate the Samba Server as a possible problem. I did a reboot on the BSD box after I got NFS working so I knew it was "clean". I did not mean to imply that me starting one killed the other inadvertently.
The thing is PCBSD is a desktop orientated version of FreeBSD, for servers it's best to install plain vanilla FreeBSD - e.g. my file server isn't running X, KDE or anything else unneccessary.
I am slowly ridding my house of the Windows world once again. To that extent am checking out the "new" BSD desktops. I have to say that PCBSD is one of the best I have played with in the past few weeks. I much rather any FreeBSD to the "main" Linux Distro lines. I just love the port/package (and now PBI) systems to RPM (I know it may not be logical but that is the way I feel.)
Reboot the samba server. Don't log in or use VNC. SSH in, and use top to monitor the memory usage instead of using Ksysguard. Play music from a windows client, see what happens.
I took your advice and tried this. Just to be sure that no "X" was running on the box I edited the /etc/ttys file and commented out the line with "pdm" before the reboot. The results were not promising. I am still seeing the memory growth while using NFS (Samba is currently still disabled.)
I did however see where the memory is going. Here is the before and after:
Before (clean reboot w/out X, no music)
"Mem: 21M Active, 11M Inact, 35M Wired, 40K Cache, 20M Buf, 1900M Free"
Now (using same reboot w/out X, playing music for about 40min)
"Mem: 21M Active, 11M Inact, 85M Wired, 40K Cache, 69M Buf, 1850M Free"
Seeing it go into Wired memory seems strange. If I am reading docs on the web correctly wired is memory used by the kernel. (Of course now I cannot find my reference on the web... lol).
Thanks again for the help.
--sticf
pheet
03-18-2008, 01:18 AM
I did however see where the memory is going. Here is the before and after:
Before (clean reboot w/out X, no music)
"Mem: 21M Active, 11M Inact, 35M Wired, 40K Cache, 20M Buf, 1900M Free"
Now (using same reboot w/out X, playing music for about 40min)
"Mem: 21M Active, 11M Inact, 85M Wired, 40K Cache, 69M Buf, 1850M Free"
Seeing it go into Wired memory seems strange. If I am reading docs on the web correctly wired is memory used by the kernel. (Of course now I cannot find my reference on the web... lol).
--sticf
Memory usage looks fine to me - after playing music, the disk cache and cached file data use is larger, as one would expect. The memory used by the disk cache won't be released until it's needed (not much of a cache otherwise) and as there's still 1850M free, it's not. This is why the memory usage appears to increase, and doesn't decrease when you stop reading the files.
Read http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/misc.html#TOP-FREEMEM and the man page for top (http://www.freebsd.org/cgi/man.cgi?query=top&sektion=1#end) for an understanding of how FreeBSD uses memory.
Try having the server up for several hours of use with the current config, then see if you can still SSH in ok. If so, the problem with the lockup would appear to be with VNC and/or KDE/X rather than the Samba service or the memory usage.
sticf
03-19-2008, 09:44 PM
Well I have been testing it for a few days and here is what I have come up with. I have tried to break in in any way I knew how but I have found that the only time this happens is when I actually restart my VNC server. I know in the initial post I said "start/restart" but over the past 1.5 days it was only restarts. So I took a long look at my script that restarted the server. I made a change in how I waited between stopping and starting the server by adding "&&" to the stop line and following that with the start command and options. Instead of 2 lines like I had before. It seems that I no longer experience the Lockups and I am able to run the box with PMD enabled w/out problems.
Thanks for taking the time to read my post and pointing me to some possible problems. Now back to the man pages for some more reading on the rc system... lol
--sticf
TerryP
03-19-2008, 10:31 PM
viewtopic.php?f=30&t=11025 (http://forums.pcbsd.org/viewtopic.php?f=30&t=11025)
that link should point to a practical introduction.
sticf
03-19-2008, 11:23 PM
TerryP,
Thanks for the link. Hopefully I will find what I need in there... Reading man pages (and pages, and pages.. ) via the console or even on the web is just crazy on the eyes... lmao
--sticf
TerryP
03-20-2008, 03:10 AM
Try alternating between a terminal, web browser, and instant messenger for 12 hours.... haha
pheet
03-20-2008, 04:53 PM
Thanks for taking the time to read my post and pointing me to some possible problems
No problem 8) . A bit of Sherlock Holmes style deduction :wink: - sometimes the hardest part is finding what is causing the problem :)
Please add [ solved ] to this forum topic's title BTW:
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.