Default threads for webapp are set too high
Closed this issue · 2 comments
I recently showed some Nextclade web. We dropped some 100 SC2 sequences and I was surprised how long it took for the first results to show up.
The likely culprit is that the number of threads to use was set at 8 (likely the default for their system, as I don't think they have customized it).
On my own system, I've experimented a little and settled on 3 threads - even though I have 10 cores.
There are good reasons to reduce our default to something like 3 for Nextclade web:
- Speedup is negligent for more threads
- Thread setup has a startup cost proportional to the number of threads used
- Most users of Nextclade web use (only) 10-100 sequences
If even for my routine analysis of 3000 SC2 sequences I don't benefit from more than 3 threads, then the average user definitely does not.
On top, startup delay is more important than time to finish analysis as people can already see partial results even if the analysis takes time.
Overall, I propose we set the default number of threads to use for Web to min(2, cores)
. Those who use Nextclade for large amounts of sequences can up the number of threads, but there will be few. Overall changing the default will make Nextclade snappier for almost everyone and leave better first impressions.
Curiously, we reduced the threads from 8 to 3 in the past - I wonder how this user got 8 and not 3:
nextclade/docs/changes/CHANGELOG.old.md
Line 338 in 4d62bb7
Note, I don't remember who the user was, but we were on safari. Maybe this matters.
I can reproduce that on safari we set the default number of threads to 8! In contrast to what the code suggests:
nextclade/packages/nextclade-web/src/helpers/getNumThreads.ts
Lines 4 to 7 in 4d62bb7
This is Nextclade 3.8.1 on Safari on my M1 Mac 14.5
On Chrome, the default is 3 - interestingly. So it seems that our code for thread defaults only works on Chromium?