cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Did you know you can get an answer in less than 2 hours? Try asking a question now!

Why does dropbox need so many threads?

2,623 Views
4 Comments
7 Votes
Level 1

So, I've always been looking at ways to tidy up my system and improve security.  In doing so, I noticed that on my quad core system with only 8G of RAM, dropbox is spawning 43 threads for a instance.

While I understand the concept of using a thread pool to improve efficiency in I/O bound applications, this is somewhat ridiculous.  It's no wonder you're using so much RAM and take so long to start up given all the locking and synchronization you're probably using just to coordinate those threads.

It would be really nice to be able to provide some way for people who actually understand the performance characteristics of their systems to set how many threads get used.

4 Comments

On my Windows PC: 105 threads, 240 MB of RAM used. I have just 3 files in my dropbox, 8 MB in total. Does Dropbox keep in RAM 20 copies of my files, just to be sure that they are synchronized ?

Kesarion Level 2
Level 2

Agreed, why would Dropbox need over 100 threads on a 4 core processor? 4-8 threads would yield many times the performance of 100 threads.

 

Also, spawning a thread to run one opperation is an order of magnitude more costly than just running that opperation, and unfortunately that seems to be what they're used for.

 

This seems like it could use improvement. Could we get a comment from a representative here?

JonSummers Level 2
Level 2

Thanks Kesarion

You identified a real problem with Dropbox -  the extremely wasteful thread useage.

On OSX I quit Dropbox desktop services  after booting unless I am actually using it.

SSL connections no longer errror out because of system thread limits.

catypus Level 2
Level 2

Well let's see. OSX, 16GB RAM, 2 Core processor... my DropBox is using:

 

175MB RAM and 122 threads

 

However, that doesn't mean any of the threads are active...

But that brings up an interesting question. How many threads CAN I spawn (with Java anyway)?

I ran threads and called .sleep() on each and could get 4094 open before the JVM simply ran out of memory.

 

 

Now, my understanding of Threads is dare I say Low-Intermediate but I do know that many threads does not mean performance is hurting. HOWEVER, it does seem like threads are not being used very efficiently since DropBox is not doing SO much. Mainly from a user standpoint its:

 

1. Staying ready to upload files

2. Reaching out to Notification servers for new information

3. Scanning itself for new files?

4. Reaching out to see if it needs to download anything new...

 

Compare this to Chrome, which including all the Chrome Helper tasks that are open is using 373 threads for 9 Tabs, all of which have a great deal of media and additional connects that they are making.

 

 

In conclusion to this little investigation, I really don't know why so many threads are being used (or why 175MB of memory is in use for my 30 files and 1 directory) but they certainly aren't consuming much power or processor time so... yeah.

 

Anyone know any more about this?