Extreme CPU load and slow operation with external storage SMB/CIFS
Steps to reproduce
- Mount an external storage (SMB / CIFS ).The mounted tree consist of some hundred files
- When trying to access the fies from browser, scrolling down gets slower and slower and uses more CPU and RAM, eventually the browser gives messages saying the page is not responsive etc. It works slightly better on Firefox than Chrome.
Server configuration
Operating system: Ubuntu 16.04
Web server: Apache
PHP version: 7.0.22
Nextcloud version: 12.0.3
Are you using external storage, if yes which one: SMB/CIFS
Are you using encryption: no
Are you using an external user-backend, if yes which one: LDAP/
Client configuration
Browser: Firefox, Chrome, Opera
+1
cc @icewind1991 @danxuliu Is this related to the storage requests or to the JS part?
The same when using local external storage
+1
Same problem, very slow plus with FullTextSearch elasticsearch indexing. 4 CPU 100% constantly.
Still having this problem with 12.0.4, most of the time it functions normally, but occasionally CPU load becomes 100+, this is possibly due to client scanning the network share:
22472 apache 20 0 308m 7200 5596 R 54.4 0.0 2:55.19 smbclient
27730 apache 20 0 308m 7136 5532 R 54.4 0.0 0:47.87 smbclient
20446 apache 20 0 308m 7136 5532 R 52.7 0.0 3:17.84 smbclient
22170 apache 20 0 308m 7200 5596 R 52.7 0.0 2:58.26 smbclient
22405 apache 20 0 308m 7204 5600 R 52.7 0.0 3:00.64 smbclient
24451 apache 20 0 308m 7204 5600 R 52.7 0.0 2:09.29 smbclient
24579 apache 20 0 308m 7196 5596 R 52.7 0.0 1:55.09 smbclient
25638 apache 20 0 308m 7196 5596 R 52.7 0.0 1:25.62 smbclient
26026 apache 20 0 308m 7204 5596 R 52.7 0.0 1:08.54 smbclient
26539 apache 20 0 308m 7204 5596 R 52.7 0.0 1:02.72 smbclient
23054 apache 20 0 308m 7204 5600 R 51.0 0.0 2:52.60 smbclient
23161 apache 20 0 308m 7204 5600 R 51.0 0.0 2:36.27 smbclient
23232 apache 20 0 308m 7204 5596 R 51.0 0.0 2:47.46 smbclient
23844 apache 20 0 308m 7140 5536 R 51.0 0.0 2:19.10 smbclient
23986 apache 20 0 308m 7200 5600 R 51.0 0.0 2:20.31 smbclient
24026 apache 20 0 308m 7208 5600 R 51.0 0.0 2:09.36 smbclient
24167 apache 20 0 308m 7196 5596 R 51.0 0.0 1:59.81 smbclient
24186 apache 20 0 308m 7200 5596 R 51.0 0.0 1:56.70 smbclient
26995 apache 20 0 308m 7204 5596 R 51.0 0.0 0:56.86 smbclient
27765 apache 20 0 308m 7200 5596 R 51.0 0.0 0:46.87 smbclient
28104 apache 20 0 308m 7204 5596 R 51.0 0.0 0:46.11 smbclient
28259 apache 20 0 308m 7196 5596 R 51.0 0.0 0:43.00 smbclient
28932 apache 20 0 308m 7200 5596 R 51.0 0.0 0:31.10 smbclient
29154 apache 20 0 308m 7196 5596 R 51.0 0.0 0:30.79 smbclient
23175 apache 20 0 308m 7204 5600 R 49.3 0.0 2:49.76 smbclient
23202 apache 20 0 308m 7204 5596 R 49.3 0.0 2:35.05 smbclient
23470 apache 20 0 308m 7204 5600 R 49.3 0.0 2:20.85 smbclient
24383 apache 20 0 308m 7204 5600 R 49.3 0.0 2:01.08 smbclient
25560 apache 20 0 308m 7200 5596 R 49.3 0.0 1:27.14 smbclient
25575 apache 20 0 308m 7204 5596 R 49.3 0.0 1:22.09 smbclient
26329 apache 20 0 308m 7140 5532 R 49.3 0.0 1:13.10 smbclient
28881 apache 20 0 308m 7204 5600 R 49.3 0.0 0:34.48 smbclient
22367 apache 20 0 308m 7204 5596 R 47.6 0.0 3:09.33 smbclient
22760 apache 20 0 308m 7204 5596 R 47.6 0.0 3:03.84 smbclient
23855 apache 20 0 308m 7200 5596 R 47.6 0.0 2:23.20 smbclient
26346 apache 20 0 308m 7200 5596 R 47.6 0.0 1:11.77 smbclient
27090 apache 20 0 308m 7200 5596 R 47.6 0.0 0:57.08 smbclient
30975 apache 20 0 308m 7200 5596 S 45.9 0.0 0:00.50 smbclient
22509 apache 20 0 308m 7204 5596 R 44.2 0.0 2:57.16 smbclient
26599 apache 20 0 308m 7200 5596 R 42.5 0.0 1:06.77 smbclient
23626 apache 20 0 308m 7136 5532 R 40.8 0.0 2:20.18 smbclient
25140 apache 20 0 308m 7208 5600 R 40.8 0.0 1:30.27 smbclient
28193 apache 20 0 308m 7196 5596 R 40.8 0.0 0:39.16 smbclient
29195 apache 20 0 308m 7204 5596 R 40.8 0.0 0:29.28 smbclient
25022 apache 20 0 308m 7204 5600 R 39.1 0.0 1:42.28 smbclient
24983 apache 20 0 308m 7200 5600 R 37.4 0.0 1:44.22 smbclient
22578 apache 20 0 308m 7200 5596 R 35.7 0.0 2:55.79 smbclient
22600 apache 20 0 308m 7200 5600 R 35.7 0.0 2:49.48 smbclient
22683 apache 20 0 308m 7140 5536 R 35.7 0.0 2:49.76 smbclient
22835 apache 20 0 308m 7136 5532 R 35.7 0.0 1150:13 smbclient
22945 apache 20 0 308m 7140 5532 R 35.7 0.0 2:39.04 smbclient
23083 apache 20 0 308m 7204 5600 R 35.7 0.0 2:42.46 smbclient
23715 apache 20 0 308m 7208 5600 R 35.7 0.0 2:29.07 smbclient
23923 apache 20 0 308m 7136 5532 R 35.7 0.0 2:16.45 smbclient
25096 apache 20 0 308m 7204 5600 R 35.7 0.0 1:32.21 smbclient
25604 apache 20 0 308m 7204 5596 R 35.7 0.0 1:21.59 smbclient
26004 apache 20 0 308m 7140 5532 R 35.7 0.0 1:11.02 smbclient
26500 apache 20 0 308m 7204 5600 R 35.7 0.0 1:04.38 smbclient
27039 apache 20 0 308m 7200 5600 R 35.7 0.0 0:58.10 smbclient
28046 apache 20 0 308m 7140 5536 R 35.7 0.0 0:42.30 smbclient
29118 apache 20 0 308m 7200 5596 R 35.7 0.0 0:30.80 smbclient
7856 apache 20 0 308m 7308 5584 R 34.0 0.0 16:00.41 smbclient
20843 apache 20 0 308m 7200 5596 R 34.0 0.0 3:11.50 smbclient
22485 apache 20 0 308m 7204 5600 R 34.0 0.0 2:49.63 smbclient
22955 apache 20 0 308m 7200 5596 R 34.0 0.0 3:03.74 smbclient
23024 apache 20 0 308m 7200 5596 R 34.0 0.0 2:49.61 smbclient
23487 apache 20 0 308m 7208 5600 R 34.0 0.0 2:19.38 smbclient
23932 apache 20 0 308m 7200 5596 R 34.0 0.0 2:16.80 smbclient
24398 apache 20 0 308m 7204 5596 R 34.0 0.0 1:53.63 smbclient
24692 apache 20 0 308m 7204 5596 R 34.0 0.0 1:54.35 smbclient
26645 apache 20 0 308m 7200 5596 R 34.0 0.0 1:07.98 smbclient
27841 apache 20 0 308m 7204 5596 R 34.0 0.0 0:48.62 smbclient
28837 apache 20 0 308m 7208 5600 R 34.0 0.0 0:30.37 smbclient
24001 apache 20 0 308m 7200 5596 R 32.3 0.0 2:04.22 smbclient
27183 apache 20 0 308m 7208 5600 R 32.3 0.0 0:52.16 smbclient
Can we please have a configuration variable to limit the number of smbclient started by the service?
I have also encountered this, running NextCloud 13.0.7 on Proxmox VE in a Debian 9.5 LXC.
+1 on Next Cloud with Proxmox
I've worked around this by creating an hourly cron job to kill any long-running smbclient processes. Not ideal (obvi), but keeps CPU usage down and doesn't seem to have any side effects that I've noticed.
I encountered this problem after upgrading to Nextcloud 15
My process list looks like the one posted by @LnLogN
My ram usage looks like this:
The only reason it stopped being so high is because I disabled external storage.
I am running on Nginx + FastCGI. Local SMB server. The problem only occurs when external storage is on.
I'm have the same issue - as soon as a user clicks on a screen that has external storage on it, the NC server will fire up one smbclient process using 100% CPU.
I've tested with SFTP in place of smbclient - CPU usage is a lot better, but opening shared folders takes 1 - 2 seocnds on every click.
bump
Is there anything happening with this?
We're a microsoft school, so all of our existing files are on Windows machines.
Every time I click on an SMB share (the test one is our 'staff' share, a Tb or so of data) I get one new instance of smbclient running on the server @ 100% CPU.
One user (myself) clicking around for 10 minutes can get 20+ instances of smbclient running, each using as much CPU as possible, which will drag the whole VM host down to the ground if I let it.
We really want this software in our school, but in it's current state we're not able to do much more than log in and look at it.
Please try to install samba-common package. Smbclient doesn't depend on it directly, but I think nextcloud needs it for some SMB operations when running on ubuntu.
sudo apt install samba-common
Bug in ubuntu that may be related: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1758653
I would expect better performance if https://github.com/eduardok/libsmbclient-php installed and enabled.
Installing libsmbclient-php (apt install php-smbclient on ubuntu) seems to have fixed the 100% CPU usage. I already had samba-common installed when I was having the 100% CPU usage issue. The version available via repository is currently 0.8, rather than the 1.0 of libsmbclient-php on github, so I may decide to pull that newer version and test some more.
The php version of libsmbclient has solved the high CPU issue for me too.
I ended up needing to install it via pecl, which got me version 1.0.0 - the debian repos used in the "fpm" docker image didn't have the package for whatever reason.
@maireanu Is this still relevant? There are some reports that https://github.com/eduardok/libsmbclient-php helps.
This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.
php-smbclient installed via apt resolved this issue for me as well.
Trouble machine was a Nextcloud 16.0.1 in a Debian 9 LXC container under Proxmox.
smb share is LXC container on same hardware node with 6-disk SSD zfs array.
dataset is ~1TiB of RAW dSLR images & jpegs
"sudo -u www-data php occ preview:generate:all" to recreate.
smbclient spawns multiple processes and climbs to 100% across 16 procs and remains so until killed.
Hi guys, apologies for bumping this again. I had same issues as above, after install inthe php-smbclient, it has dropped CPU usages drastically, however navigating smb folders are soooo much slower.
Anyone else experienced this?