Nmap Development mailing list archives

Re: Limit CPU usage


From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 10 Jan 2017 22:13:28 -0600

Aaron,

Thanks for asking. In most cases, the CPU usage of Nmap is negligible
because most of its (wall clock) time is spent waiting for packets. The
parallelism settings are designed to minimize that time, raising
(relatively) the importance of CPU speed. NSE's parallelism is more fixed
and not as responsive to network conditions as the core scanning engine is.
It will generally just start up to 1000 worker threads and keep adding new
ones as the old ones finish. If --min-parallelism is higher than 1000, that
will be used as a limit instead. The --max-parallelism is used to limit the
number of connected sockets at any time; if it is unset, the limit is 20.
So of those 1000 threads, 980 are probably waiting their turn to use the
network. NSE loops over the threads every 50 milliseconds checking for
network events.

I'm not sure which of these mechanisms would be the best candidate for
reducing NSE CPU usage. If the network is fast and services are responding,
it will pretty much work as hard as it can to keep up.

Dan

On Wed, Jan 4, 2017 at 2:10 AM, Aaron Lewis <the.warl0ck.1989 () gmail com>
wrote:

I'm trying to limit the cpu usage of nmap.

So I add a scan-delay and max-parallism, it works for tcp scans, but
does not seem to work for NSE scripts.

Am I wrong?

--
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: