mirror of
https://github.com/samba-team/samba.git
synced 2025-02-24 13:57:43 +03:00
s3-prefork: Allow better management of allowed_clients
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
This commit is contained in:
parent
eb8a0c7672
commit
2a0aac0adc
@ -345,6 +345,23 @@ static void prefork_cleanup_loop(struct prefork_pool *pfp)
|
||||
|
||||
}
|
||||
|
||||
int prefork_count_allowed_connections(struct prefork_pool *pfp)
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
|
||||
c = 0;
|
||||
for (i = 0; i < pfp->pool_size; i++) {
|
||||
if (pfp->pool[i].status == PF_WORKER_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
c += pfp->pool[i].allowed_clients - pfp->pool[i].num_clients;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max)
|
||||
{
|
||||
int i;
|
||||
@ -360,6 +377,21 @@ void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max)
|
||||
}
|
||||
}
|
||||
|
||||
void prefork_decrease_allowed_clients(struct prefork_pool *pfp)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pfp->pool_size; i++) {
|
||||
if (pfp->pool[i].status == PF_WORKER_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pfp->pool[i].allowed_clients > 1) {
|
||||
pfp->pool[i].allowed_clients--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void prefork_reset_allowed_clients(struct prefork_pool *pfp)
|
||||
{
|
||||
int i;
|
||||
|
@ -181,16 +181,33 @@ int prefork_retire_children(struct prefork_pool *pfp,
|
||||
int prefork_count_active_children(struct prefork_pool *pfp, int *total);
|
||||
|
||||
/**
|
||||
* @brief Inform all children that they are allowed to accept 'max' clients
|
||||
* now. Use this when all children are already busy and more clients
|
||||
* are trying to connect. It will allow each child to handle more than
|
||||
* one client at a time, up to 'max'.
|
||||
* @brief Count the number of actual connections currently allowed
|
||||
*
|
||||
* @param pfp The pool.
|
||||
*
|
||||
* @return The number of connections that can still be opened by clients
|
||||
* with the current pool of children.
|
||||
*/
|
||||
int prefork_count_allowed_connections(struct prefork_pool *pfp);
|
||||
|
||||
/**
|
||||
* @brief Increase the amount of clients each child is allowed to handle
|
||||
* simultaneaously. It will allow each child to handle more than
|
||||
* one client at a time, up to 'max' (currently set to 100).
|
||||
*
|
||||
* @param pfp The pool.
|
||||
* @param max Max number of clients per child.
|
||||
* @param max Max number of allowed connections per child
|
||||
*/
|
||||
void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max);
|
||||
|
||||
/**
|
||||
* @brief Decrease the amount of clients each child is allowed to handle.
|
||||
* Min is 1.
|
||||
*
|
||||
* @param pfp The pool.
|
||||
*/
|
||||
void prefork_decrease_allowed_clients(struct prefork_pool *pfp);
|
||||
|
||||
/**
|
||||
* @brief Reset the maximum allowd clients per child to 1.
|
||||
* Does not reduce the number of clients actually beeing served by
|
||||
|
Loading…
x
Reference in New Issue
Block a user