Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200429131014.GA9215@openwall.com>
Date: Wed, 29 Apr 2020 15:10:14 +0200
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: Reduce CPU load. Is it possible?

On Wed, Apr 29, 2020 at 12:21:48PM +0200, MA40 wrote:
> When John the Ripper is running, the CPU is overloaded (95% in my case).

The CPU load should ideally be over 99%.  Having it at only 95% suggests
something is suboptimal - e.g., you might be using OpenMP yet have other
load on the system.  OpenMP behaves suboptimally when there's other load.

Yes, this is very different (almost the opposite) from what you asked.

> Would it be possible to configure it so that it does not work at full
> capacity so as not to load the CPU so much? For example, configure it to
> work at 80%.

Yes.  Ideally, you'd probably want not to limit CPU usage, but rather to
have JtR yield execution to other tasks precisely when those other tasks
need CPU time.  When not using OpenMP, this is achieved by setting
"Idle = Y" in john.conf - in fact, it is set that way by default.
Unfortunately, that approach is inefficient when using OpenMP, so in
that case this setting is ignored.

You can continue using OpenMP, but use OMP_NUM_THREADS to limit the
number of threads, like this:

OMP_NUM_THREADS=7 ./john usual options here

A reasonable setting on a system with slight other load is one fewer
than the number of logical CPUs (e.g., 7 on a system with 8 "CPUs").

A reason to continue using OpenMP is that it lets you adjust the thread
count when you interrupt/restore a job.  For example, you may interrupt
your currently running job and continue it with:

OMP_NUM_THREADS=7 ./john --restore

The alternative to OpenMP is "--fork".  A drawback of "--fork" is that
you'd have to choose a count right away and then not be able to adjust
it on "--restore".  Another drawback of "--fork" is that the fork'ed
processes might not always terminate at nearly the same time.

If you specify a forked process count that is over one half the number
of your logical CPUs, OpenMP will be automatically disabled and the Idle
setting will take effect.  If you specify a forked process count that is
slightly lower than the number of your logical CPUs (e.g., "--fork=7" on
a system with 8 "CPUs"), you'll also achieve what you asked for, but I
recommend that you actually specify a count exactly matching the number
of your logical CPUs ("--fork=8" in that example).  When the Idle
setting works, there's usually no reason not to use all of the CPUs -
the system will be very responsive anyway.

When not using OpenMP anyway, you might also achieve slightly better
performance by making a "./configure --disable-openmp" build of JtR.

I hope this helps and isn't too much detail.

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.