Jonnavithula Sharma
2014-Aug-11 06:34 UTC
[Samba] Restriciting memory usage for samba using Cgroups
Hi Currently we are using cgroups to limit samba memory usage on our target we have limited the memory to 20MB and we are able to see samba is restricted to it. With this we are able to restrict the cache memory to ~34MB (never goes beyond this) BUt issue we arere facing is the Buffers are increasing gradually and it is not able to restrict. Commands Used to restrict memory on target: echo <samba pid >default/tasks echo 20971520 > default/memory.limit_in_bytes Initial memory status: root at ltqcpe:/sys/fs/cgroup/memory# cat /proc/meminfo MemTotal: 113760 kB MemFree: 41692 kB Buffers: 4108 kB Cached: 30936 kB SwapCached: 0 kB After 5 hrs memory Status Looks like this root at ltqcpe:/sys/fs/cgroup/memory# cat /proc/meminfo cat /proMemTotal: 113760 kB MemFree: 9744 kB Buffers: 33448 kB Cached: 32144 kB SwapCached: 0 kB Did some one faced this issue? Could some one has any inputs to fix this problem?Is there any way to limit buffers also Other Details: Linux Version : 3.10.12 Samba Version : 3.0.24 PS: We are doing 1gb file transfer(both read and write simultaneously) for samba testing Regards, Sarma J
Volker Lendecke
2014-Aug-11 10:21 UTC
[Samba] Restriciting memory usage for samba using Cgroups
On Mon, Aug 11, 2014 at 12:04:40PM +0530, Jonnavithula Sharma wrote:> Hi > > Currently we are using cgroups to limit samba memory usage on our target > > we have limited the memory to 20MB and we are able to see samba is > restricted to it. > > With this we are able to restrict the cache memory to ~34MB (never goes > beyond this) > > BUt issue we arere facing is the Buffers are increasing gradually and it is > not able to restrict. > > Commands Used to restrict memory on target: > > echo <samba pid >default/tasks > echo 20971520 > default/memory.limit_in_bytes > > Initial memory status: > root at ltqcpe:/sys/fs/cgroup/memory# cat /proc/meminfo > MemTotal: 113760 kB > MemFree: 41692 kB > Buffers: 4108 kB > Cached: 30936 kB > SwapCached: 0 kB > > After 5 hrs memory Status Looks like this > root at ltqcpe:/sys/fs/cgroup/memory# cat /proc/meminfo > cat /proMemTotal: 113760 kB > MemFree: 9744 kB > Buffers: 33448 kB > Cached: 32144 kB > SwapCached: 0 kB > > Did some one faced this issue? > Could some one has any inputs to fix this problem?Is there any way to limit > buffers alsoI'd say that this is more a kernel question than a Samba one. Samba is user space and has no control how the kernel makes use of the physical memory it has. All Samba can do is not leak memory :-) If you limit Samba to something very low, and I would consider 20MB for all Samba processes together very low, then eventually you might run into problems. I'm sure that Samba does not really handle an out-of-memory condition gracefully at every point. I hope we don't segfault, but we might exit a server hard when it reaches its limit. What is your goal? Why do you want a hard limit on the buffers in-kernel? In my experience, the kernel is pretty good at balancing the various types of memory allocation. And unused physical memory is badly used. If free space is available, why not use it for buffers? If you have an application that is supposed to NEVER be swapped out under pressure, you might want to mlock() the affected ranges and let the kernel balance the rest. With best regards, Volker Lendecke -- SerNet GmbH, Bahnhofsallee 1b, 37081 G?ttingen phone: +49-551-370000-0, fax: +49-551-370000-9 AG G?ttingen, HRB 2816, GF: Dr. Johannes Loxen http://www.sernet.de, mailto:kontakt at sernet.de
Apparently Analagous Threads
- Clustering with Mahalanobis Distance
- RSync hangs up on file transfer
- high cpu load with share_conflict on browsing and opening files
- [PATCH][cfq-cgroups] Introduce cgroups structure with ioprio entry.
- [PATCH][cfq-cgroups] Interface for parameter of cfq driver data