I am currently dealing with a script which make some checks & insertions for each databases of a Mongo server. It’s multithreading.
for (int i = 0; i < countDatabase; i++) {
new threadDatabase(database.get(i).toString()).start();
}
Problem : I have 16 databases to parse…I am afraid the PC where the script will be set up, won’t manage 16 (or more) threads…
Any ideas how to deal a large number of threads ? I heard about pool, but not sure it can deal with database name I send as parameter…
Thanks
16 threads on a PC?
Looking at my Windows Task manager/Performance, it shows 1238 threads running. It’s not even breaking a sweat. Top process is sidebar.exe – 66 threads.
OK, so you’re running some other U**xy OS – 16 threads not likely to be a problem there either.
16 threads is nothing. If they are all CPU-intensive, the box will get loaded up but, hey, that’s the point!
Try a pool if you have to, maybe to try and improve performance, but don’t do it just because you are afraid that 16 threads is too much for your OS.
Rgds,
Martin