libfuse / sshfs

A network filesystem client to connect to SSH servers
GNU General Public License v2.0
5.74k stars 488 forks source link

sshfs client memory consumption #297

Closed Ric57100 closed 3 months ago

Ric57100 commented 4 months ago

Hi,

I would like to know why sshfs client consumes more and more memory over time, until it causes an out of memory (The remote FS contains a lot of small files). As you can see in the screenshot, after less than a month, the process uses almost 1GB of memory (RSS field), or even more than a GB taking into account the virtual memory (VSZ field).

To prevent such a situation I have to unmount / mount remote FS. image

Does anyone have an explanation?

h4sh5 commented 3 months ago

It's because SSHFS caches file reads for improved performance. That probably means the more files you list / read, the more it stores in the cache in memory.

You should be able to disable that by using -o cache=no

(the option in help being -o cache=BOOL enable caching {yes,no} (default: yes))