11

I recently noticed that Dropbox is taking about 50-90% of my CPU for more than just a few seconds sometimes - mostly when downloading/syncing many or large files.

Still, I guess that even when syncing a lot of data, there's no reason to use that much CPU (perhaps network or disk..)

Any ideas or suggestions? How can I make Dropbox use less CPU?

(running on Ubuntu 12.04 on Lenovo X220 with SSD Drive)

2
  • 1
    One thing I do is start dropbox with a niceness of 18. Perhaps this would help your situation too. Apr 22, 2013 at 18:28
  • (ORIGINALLY POSTED BY: @Rafael) Hashing takes often longer than expected because the dropbox cache keeps copies of old files. Check the ./dropbox.cache folder.
    – BiggJJ
    Jun 30, 2013 at 18:33

6 Answers 6

12

Good shout with using cpulimit.

I found this could be simplified (when logged as root) to

cpulimit -e dropbox -l 10

where -l specifies percentage of CPU. Note this is for total CPU over all cores, so a dual core would have a limit of 200

Output:

cpulimit -e dropbox -l 10
Process 2641 detected
2
  • that would require sudo password, tho adding that line to sudoers will do the trick I guess Aug 19, 2014 at 22:53
  • @AquariusPower If you were not logged in as root then it would indeed require sudo. (I was logged in as root - edited to clarify) thanks Aug 13, 2015 at 9:52
7

Dropbox computes a hash of all files that it's going to sync, it uses it both to determine if they changed and to avoid uploading content that is already in their cloud (another customer has the same file).

Calculating hashes takes CPU power. It's usually noticeable at login.

3
  • 1
    I see.. I guess that might be the reason - though it's still quite annoying sometimes! Thanks :) Oct 26, 2012 at 16:54
  • maybe some system way, renice it to 19? May 2, 2014 at 17:52
  • 4
    you can use cpulimit Aug 19, 2014 at 22:59
3

You can limit the cpu usage of any application this way:

#nPidDropbox=`ps -A -o pid,comm |egrep " dropbox$" |sed -r "s'^ *([[:digit:]]*) .*'\1'"`
nPidDropbox=`pgrep dropbox`

renice -n 19 `ps -L -p $nPidDropbox -o lwp |tr "\n" " "`
cpulimit -p "$nPidDropbox" -l 10

The first line of code is just a pid guesser. The 2nd line is to help cpulimiter work better while not requiring sudo.

2

Perhaps there is more to it than the problem of hashing.

One thing that I find strange is that with lsof | grep dropbox I do not see many open files under ~/Dropbox for the dropbox process.

What I did was to aptitude purge all packages related to dropbox, rm -r the 3 ~/.dropbo* folders (but not the ~/Dropbox folder), and then enable partner repositories and aptitude install nautilus-dropbox. Whether this procedure is problematic I do not know.

After a while (an hour?) with the new install and with dropbox CPU load I no longer see the load, so apparently the problem is solved. Perhaps the purging has helped or I just had a very large batch of files that needed updating.

2
  • Thanks! I'll give it a try the next time something like this happens again. Mar 20, 2013 at 22:34
  • I have already nautilus-dropbox and only one ~/.dropbox, my cpu usage and sysload is high :( May 2, 2014 at 17:52
2

Now, 2019. Dropbox is on version 79. Using it with Debian on a i7 7th gen, it still consumes ~ 15% Cpu when not uploading or downloading files.

In its download page, Dropbox says how to install in a headless environment.

The dropboxd executable always open tray icon when running on X. I found that running it always in headless mode made CPU consumption lower to 1% after few minutes

#!/bin/bash

unset DISPLAY
while : ; do
  rm -rf $HOME/.dropbox/dropbox.pid
  rm -rf /tmp/dropbox*
  ~/.dropbox-dist/dropboxd
  sleep 10
done >> /dev/null

But be aware you can run this only after login on Dropbox

1

This happens to me frequently even when Dropbox is not actually syncing anything (there the hashing answer makes sense to me). My quick solution is to simply set Dropbox to stop syncing. Even tho it isn't actually syncing anything this seems to kill the CPU usage. Just have to remember to turn it back on later.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .