I recently noticed that transfer speeds with samba(exclusively, even with loopback - iperf works just fine) have dropped to around 5MB/s on my gigabit network. Before it could easily reach 70MB/s and beyond.

I actually wrote a long description of the problem here but then decided to double-check everything and noticed that htop reports 100% RAM usage and most of the bar was yellow, e.g. reserved for cache.

After clearing the cache with sync; echo 3 > /proc/sys/vm/drop_caches (found at http://www.hosting.com/support/linux/clear-memory-cache-on-linux-server), transfer speeds immediately went from the 5MB/s to 50MB/s.

I'm being told that Linux manages its memory efficiently and I think using spare RAM to speed up disk access is great, so I'm suspecting there's something wrong with my configuration. Is this the case or is this a samba/linux quirk?

I'm using samba 3.6.6 on Ubuntu 12.10.


Almost everything will slow down when memory usage hits 100%. Try checking disk activity and you may find your disk I/O is queuing up. Otherwise free memory is used for buffers, and can be used to prevent writing data for directories like /tmp to disk. When you don't have any free memory lots of things which would be done in memory start becoming disk activities.

It is possible that samba is getting paged out to disk between calls. This will slow down performance significantly. I would expect performance to be even worse if this were happening.

sar is a good tool to see what is happening. df is a good tool to determine how big the contents of \tmp and other memory mapped disk are. vmstat will show swap usage and activity.

If you run out of space in swap in a case like this, your server is likely to fail.

  • 1
    I would also add iotop to the list of useful tools. – Marcin May 30 '13 at 13:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.