mirror of https://gitee.com/openkylin/libvirt.git
Introduce max_queued_clients
This configuration knob lets user to set the length of queue of connection requests waiting to be accept()-ed by the daemon. IOW, it just controls the @backlog passed to listen: int listen(int sockfd, int backlog);
This commit is contained in:
parent
2737aaafe9
commit
1199edb1d4
|
@ -414,6 +414,7 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||||
GET_CONF_INT(conf, filename, min_workers);
|
GET_CONF_INT(conf, filename, min_workers);
|
||||||
GET_CONF_INT(conf, filename, max_workers);
|
GET_CONF_INT(conf, filename, max_workers);
|
||||||
GET_CONF_INT(conf, filename, max_clients);
|
GET_CONF_INT(conf, filename, max_clients);
|
||||||
|
GET_CONF_INT(conf, filename, max_queued_clients);
|
||||||
|
|
||||||
GET_CONF_INT(conf, filename, prio_workers);
|
GET_CONF_INT(conf, filename, prio_workers);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ struct daemonConfig {
|
||||||
int min_workers;
|
int min_workers;
|
||||||
int max_workers;
|
int max_workers;
|
||||||
int max_clients;
|
int max_clients;
|
||||||
|
int max_queued_clients;
|
||||||
|
|
||||||
int prio_workers;
|
int prio_workers;
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ module Libvirtd =
|
||||||
let processing_entry = int_entry "min_workers"
|
let processing_entry = int_entry "min_workers"
|
||||||
| int_entry "max_workers"
|
| int_entry "max_workers"
|
||||||
| int_entry "max_clients"
|
| int_entry "max_clients"
|
||||||
|
| int_entry "max_queued_clients"
|
||||||
| int_entry "max_requests"
|
| int_entry "max_requests"
|
||||||
| int_entry "max_client_requests"
|
| int_entry "max_client_requests"
|
||||||
| int_entry "prio_workers"
|
| int_entry "prio_workers"
|
||||||
|
|
|
@ -485,6 +485,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
false,
|
false,
|
||||||
|
config->max_queued_clients,
|
||||||
config->max_client_requests)))
|
config->max_client_requests)))
|
||||||
goto error;
|
goto error;
|
||||||
if (sock_path_ro) {
|
if (sock_path_ro) {
|
||||||
|
@ -497,6 +498,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
true,
|
true,
|
||||||
|
config->max_queued_clients,
|
||||||
config->max_client_requests)))
|
config->max_client_requests)))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -522,6 +524,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
false,
|
false,
|
||||||
|
config->max_queued_clients,
|
||||||
config->max_client_requests)))
|
config->max_client_requests)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -562,6 +565,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
||||||
config->auth_tls,
|
config->auth_tls,
|
||||||
ctxt,
|
ctxt,
|
||||||
false,
|
false,
|
||||||
|
config->max_queued_clients,
|
||||||
config->max_client_requests))) {
|
config->max_client_requests))) {
|
||||||
virObjectUnref(ctxt);
|
virObjectUnref(ctxt);
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -257,6 +257,12 @@
|
||||||
# over all sockets combined.
|
# over all sockets combined.
|
||||||
#max_clients = 20
|
#max_clients = 20
|
||||||
|
|
||||||
|
# The maximum length of queue of connections waiting to be
|
||||||
|
# accepted by the daemon. Note, that some protocols supporting
|
||||||
|
# retransmission may obey this so that a later reattempt at
|
||||||
|
# connection succeeds.
|
||||||
|
#max_queued_clients = 1000
|
||||||
|
|
||||||
|
|
||||||
# The minimum limit sets the number of workers to start up
|
# The minimum limit sets the number of workers to start up
|
||||||
# initially. If the number of active clients exceeds this,
|
# initially. If the number of active clients exceeds this,
|
||||||
|
|
|
@ -671,7 +671,7 @@ virLockDaemonSetupNetworkingNative(virNetServerPtr srv, const char *sock_path)
|
||||||
#if WITH_GNUTLS
|
#if WITH_GNUTLS
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
false, 1)))
|
false, 0, 1)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virNetServerAddService(srv, svc, NULL) < 0) {
|
if (virNetServerAddService(srv, svc, NULL) < 0) {
|
||||||
|
|
|
@ -745,6 +745,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
false,
|
false,
|
||||||
|
0,
|
||||||
5)))
|
5)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
|
||||||
virNetTLSContextPtr tls,
|
virNetTLSContextPtr tls,
|
||||||
#endif
|
#endif
|
||||||
bool readonly,
|
bool readonly,
|
||||||
|
size_t max_queued_clients,
|
||||||
size_t nrequests_client_max)
|
size_t nrequests_client_max)
|
||||||
{
|
{
|
||||||
virNetServerServicePtr svc;
|
virNetServerServicePtr svc;
|
||||||
|
@ -122,7 +123,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; i < svc->nsocks; i++) {
|
for (i = 0; i < svc->nsocks; i++) {
|
||||||
if (virNetSocketListen(svc->socks[i], 0) < 0)
|
if (virNetSocketListen(svc->socks[i], max_queued_clients) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* IO callback is initially disabled, until we're ready
|
/* IO callback is initially disabled, until we're ready
|
||||||
|
@ -155,6 +156,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||||
virNetTLSContextPtr tls,
|
virNetTLSContextPtr tls,
|
||||||
#endif
|
#endif
|
||||||
bool readonly,
|
bool readonly,
|
||||||
|
size_t max_queued_clients,
|
||||||
size_t nrequests_client_max)
|
size_t nrequests_client_max)
|
||||||
{
|
{
|
||||||
virNetServerServicePtr svc;
|
virNetServerServicePtr svc;
|
||||||
|
@ -185,7 +187,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; i < svc->nsocks; i++) {
|
for (i = 0; i < svc->nsocks; i++) {
|
||||||
if (virNetSocketListen(svc->socks[i], 0) < 0)
|
if (virNetSocketListen(svc->socks[i], max_queued_clients) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* IO callback is initially disabled, until we're ready
|
/* IO callback is initially disabled, until we're ready
|
||||||
|
|
|
@ -44,6 +44,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
|
||||||
virNetTLSContextPtr tls,
|
virNetTLSContextPtr tls,
|
||||||
# endif
|
# endif
|
||||||
bool readonly,
|
bool readonly,
|
||||||
|
size_t max_queued_clients,
|
||||||
size_t nrequests_client_max);
|
size_t nrequests_client_max);
|
||||||
virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||||
mode_t mask,
|
mode_t mask,
|
||||||
|
@ -53,6 +54,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
|
||||||
virNetTLSContextPtr tls,
|
virNetTLSContextPtr tls,
|
||||||
# endif
|
# endif
|
||||||
bool readonly,
|
bool readonly,
|
||||||
|
size_t max_queued_clients,
|
||||||
size_t nrequests_client_max);
|
size_t nrequests_client_max);
|
||||||
virNetServerServicePtr virNetServerServiceNewFD(int fd,
|
virNetServerServicePtr virNetServerServiceNewFD(int fd,
|
||||||
int auth,
|
int auth,
|
||||||
|
|
Loading…
Reference in New Issue