Skip to content

Commit

Permalink
Added upper bound on number of threads ZMap can use (#811)
Browse files Browse the repository at this point in the history
* added --sender-threads upper bound

* updated manpages

* removed overriding user preference if they use too many sender threads and updated manpages

* Nitpicking Warning Message

* reverted changes on auto-generated files

---------

Co-authored-by: Zakir Durumeric <zakird@gmail.com>
  • Loading branch information
phillip-stephens and zakird committed Mar 7, 2024
1 parent 24300f4 commit eb8de65
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/zmap.c
Expand Up @@ -1066,6 +1066,17 @@ int main(int argc, char *argv[])
"too few targets relative to senders, dropping to one sender");
zconf.senders = 1;
}
// reserving 1 core for the receiver/monitor thread
int sender_cap = get_num_cores() - 1;
if (zconf.senders > sender_cap) {
log_warn(
"zmap",
"ZMap has been configured to use a larger number of sending threads (%d) than the number of "
"dedicated cores that can be assigned to sending packets. We advise using only "
"(number of cores - 1 = %d) sender threads such that every sender thread and the "
"one receiver thread each have a dedicated core. Using a large number of sender threads "
"will likely decrease performance, not increase it.", zconf.senders, sender_cap);
}
#else
zconf.senders = args.sender_threads_arg;
#endif
Expand Down

0 comments on commit eb8de65

Please sign in to comment.