Skip to content

Commit

Permalink
Add: New option --max-concurrent-scan-updates
Browse files Browse the repository at this point in the history
The new startup option --max-concurrent-scan-updates is added which
allows limiting the number of scan updates which can run at the same
time.

This can be used to limit the peak memory and CPU usage when running
multiple scans at the same time.
  • Loading branch information
timopollmeier committed Aug 29, 2024
1 parent ae12708 commit 76c28df
Show file tree
Hide file tree
Showing 6 changed files with 315 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/gvmd.8
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ File mode of the unix socket
\fB--listen-owner=\fISTRING\fB\f1
Owner of the unix socket
.TP
\fB--max-concurrent-scan-updates=\fINUMBER\fB\f1
Maximum number of scan updates that can run at the same time. Default: 0 (unlimited).
.TP
\fB--max-email-attachment-size=\fINUMBER\fB\f1
Maximum size of alert email attachments, in bytes.
.TP
Expand Down
9 changes: 9 additions & 0 deletions doc/gvmd.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>Owner of the unix socket</p>
</optdesc>
</option>
<option>
<p><opt>--max-concurrent-scan-updates=<arg>NUMBER</arg></opt></p>
<optdesc>
<p>
Maximum number of scan updates that can run at the same time.
Default: 0 (unlimited).
</p>
</optdesc>
</option>
<option>
<p><opt>--max-email-attachment-size=<arg>NUMBER</arg></opt></p>
<optdesc>
Expand Down
9 changes: 9 additions & 0 deletions doc/gvmd.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ <h2>Options</h2>



<p><b>--max-concurrent-scan-updates=<em>NUMBER</em></b></p>

<p>
Maximum number of scan updates that can run at the same time.
Default: 0 (unlimited).
</p>



<p><b>--max-email-attachment-size=<em>NUMBER</em></b></p>

<p>Maximum size of alert email attachments, in bytes.</p>
Expand Down
12 changes: 12 additions & 0 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,7 @@ gvmd (int argc, char** argv, char *env[])
static gchar *broker_address = NULL;
static gchar *feed_lock_path = NULL;
static int feed_lock_timeout = 0;
static int max_concurrent_scan_updates = 0;
static int mem_wait_retries = 30;
static int min_mem_feed_update = 0;
static int vt_ref_insert_size = VT_REF_INSERT_SIZE_DEFAULT;
Expand Down Expand Up @@ -2073,6 +2074,11 @@ gvmd (int argc, char** argv, char *env[])
&listen_owner,
"Owner of the unix socket",
"<string>" },
{ "max-concurrent-scan-updates", '\0', 0, G_OPTION_ARG_INT,
&max_concurrent_scan_updates,
"Maximum number of scan updates that can run at the same time."
" Default: 0 (unlimited).",
"<number>" },
{ "max-email-attachment-size", '\0', 0, G_OPTION_ARG_INT,
&max_email_attachment_size,
"Maximum size of alert email attachments, in bytes.",
Expand Down Expand Up @@ -2452,6 +2458,12 @@ gvmd (int argc, char** argv, char *env[])
g_debug ("Sentry support disabled");
}

/* Set maximum number of concurrent scan updates */
set_max_concurrent_scan_updates (max_concurrent_scan_updates);

/* Initialize Inter-Process Communication */
init_semaphore_set ();

/* Enable GNUTLS debugging if requested via env variable. */
{
const char *s;
Expand Down
Loading

0 comments on commit 76c28df

Please sign in to comment.