2 * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef _SQUID_SRC_HELPER_CHILDCONFIG_H
10 #define _SQUID_SRC_HELPER_CHILDCONFIG_H
16 * Contains statistics of a particular type of child helper.
18 * Some derived from a helper children configuration option,
19 * some from runtime stats on the currently active children.
25 explicit ChildConfig(const unsigned int m
);
28 * When new helpers are needed call this to find out how many more
29 * we are allowed to start.
30 * \retval 0 No more helpers may be started right now.
31 * \retval N < 0 Error. No more helpers may be started.
32 * \retval N N more helpers may be started immediately.
38 * Update an existing set of details with new start/max/idle/concurrent limits.
39 * This is for parsing new child settings into an object incrementally then updating
40 * the running set without loosing any of the active state or causing races.
42 ChildConfig
&updateLimits(const ChildConfig
&rhs
);
44 /* values from squid.conf */
47 /** maximum child process limits. How many of this helper the system can cope with */
51 * Number of children to kick off at startup.
52 * set via the startup=N option.
54 * By default if undefined 1 will be started immediately for use.
55 * The minimum/idle amount will be scheduled for starting as soon as possible after startup is completed.
57 unsigned int n_startup
;
60 * Number of helper children to keep available as a buffer against sudden bursts of requests.
61 * set via the idle=N option. May be zero.
63 * The default value for backward compatibility the default for this is the same as maximum children.
64 * For now the actual number of idle children is only reduced by a reconfigure operation. This may change.
69 * How many concurrent requests each child helper may be capable of handling.
70 * Default: 0 - no concurrency possible.
72 unsigned int concurrency
;
74 /* derived from active operations */
77 * Total helper children objects currently existing.
78 * Produced as a side effect of starting children or their stopping.
80 unsigned int n_running
;
83 * Count of helper children active (not shutting down).
84 * This includes both idle and in-use children.
86 unsigned int n_active
;
89 * The requests queue size. By default it is of size 2*n_max
91 unsigned int queue_size
;
93 /// how to handle a serious problem with a helper request submission
94 enum SubmissionErrorHandlingAction
{
95 actDie
, ///< kill the caller process (i.e., Squid worker)
96 actErr
///< drop the request and send an error to the caller
98 /// how to handle a new request for helper that was overloaded for too long
99 SubmissionErrorHandlingAction onPersistentOverload
;
102 * True if the default queue size is used.
103 * Needed in the cases where we need to adjust default queue_size in
104 * special configurations, for example when redirector_bypass is used.
106 bool defaultQueueSize
;
109 } // namespace Helper
111 /* Legacy parser interface */
112 #define parse_HelperChildConfig(c) (c)->parseConfig()
113 #define dump_HelperChildConfig(e,n,c) storeAppendPrintf((e), "\n%s %d startup=%d idle=%d concurrency=%d\n", (n), (c).n_max, (c).n_startup, (c).n_idle, (c).concurrency)
114 #define free_HelperChildConfig(dummy) // NO.
116 #endif /* _SQUID_SRC_HELPER_CHILDCONFIG_H */