Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
74c119c8
Commit
74c119c8
authored
Oct 21, 2020
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
param: Fold mgt_pool.c into mgt_param_tweak.c
Refs #3250
parent
fa681397
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
84 deletions
+34
-84
Makefile.am
bin/varnishd/Makefile.am
+0
-1
mgt_param_tweak.c
bin/varnishd/mgt/mgt_param_tweak.c
+34
-0
mgt_pool.c
bin/varnishd/mgt/mgt_pool.c
+0
-83
No files found.
bin/varnishd/Makefile.am
View file @
74c119c8
...
...
@@ -88,7 +88,6 @@ varnishd_SOURCES = \
mgt/mgt_param_tbl.c
\
mgt/mgt_param_tcp.c
\
mgt/mgt_param_tweak.c
\
mgt/mgt_pool.c
\
mgt/mgt_shmem.c
\
mgt/mgt_symtab.c
\
mgt/mgt_util.c
\
...
...
bin/varnishd/mgt/mgt_param_tweak.c
View file @
74c119c8
...
...
@@ -449,3 +449,37 @@ tweak_poolparam(struct vsb *vsb, const struct parspec *par, const char *arg)
}
return
(
retval
);
}
/*--------------------------------------------------------------------
* Thread pool tweaks.
*
* The min/max values automatically update the opposites appropriate
* limit, so they don't end up crossing.
*/
int
tweak_thread_pool_min
(
struct
vsb
*
vsb
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
if
(
tweak_uint
(
vsb
,
par
,
arg
))
return
(
-
1
);
MCF_ParamConf
(
MCF_MINIMUM
,
"thread_pool_max"
,
"%u"
,
mgt_param
.
wthread_min
);
MCF_ParamConf
(
MCF_MAXIMUM
,
"thread_pool_reserve"
,
"%u"
,
mgt_param
.
wthread_min
*
950
/
1000
);
return
(
0
);
}
int
tweak_thread_pool_max
(
struct
vsb
*
vsb
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
if
(
tweak_uint
(
vsb
,
par
,
arg
))
return
(
-
1
);
MCF_ParamConf
(
MCF_MAXIMUM
,
"thread_pool_min"
,
"%u"
,
mgt_param
.
wthread_max
);
return
(
0
);
}
bin/varnishd/mgt/mgt_pool.c
deleted
100644 → 0
View file @
fa681397
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* We maintain a number of worker thread pools, to spread lock contention.
*
* Pools can be added on the fly, as a means to mitigate lock contention,
* but can only be removed again by a restart. (XXX: we could fix that)
*
* Two threads herd the pools, one eliminates idle threads and aggregates
* statistics for all the pools, the other thread creates new threads
* on demand, subject to various numerical constraints.
*
* The algorithm for when to create threads needs to be reactive enough
* to handle startup spikes, but sufficiently attenuated to not cause
* thread pileups. This remains subject for improvement.
*/
#include "config.h"
#include <stdio.h>
#include "mgt/mgt.h"
#include "mgt/mgt_param.h"
/*--------------------------------------------------------------------
* The min/max values automatically update the opposites appropriate
* limit, so they don't end up crossing.
*/
int
tweak_thread_pool_min
(
struct
vsb
*
vsb
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
if
(
tweak_uint
(
vsb
,
par
,
arg
))
return
(
-
1
);
MCF_ParamConf
(
MCF_MINIMUM
,
"thread_pool_max"
,
"%u"
,
mgt_param
.
wthread_min
);
MCF_ParamConf
(
MCF_MAXIMUM
,
"thread_pool_reserve"
,
"%u"
,
mgt_param
.
wthread_min
*
950
/
1000
);
return
(
0
);
}
int
tweak_thread_pool_max
(
struct
vsb
*
vsb
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
if
(
tweak_uint
(
vsb
,
par
,
arg
))
return
(
-
1
);
MCF_ParamConf
(
MCF_MAXIMUM
,
"thread_pool_min"
,
"%u"
,
mgt_param
.
wthread_max
);
return
(
0
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment