On Thu, Jul 25, 2013 at 04:23:33PM +0200, Michal Privoznik wrote:
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);
---
daemon/libvirtd-config.c | 1 +
daemon/libvirtd-config.h | 1 +
daemon/libvirtd.aug | 1 +
daemon/libvirtd.c | 4 ++++
daemon/libvirtd.conf | 6 ++++++
src/locking/lock_daemon.c | 2 +-
src/lxc/lxc_controller.c | 1 +
src/rpc/virnetserverservice.c | 6 ++++--
src/rpc/virnetserverservice.h | 2 ++
9 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index 107a9cf..c816fda 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -414,6 +414,7 @@ daemonConfigLoadOptions(struct daemonConfig *data,
GET_CONF_INT(conf, filename, min_workers);
GET_CONF_INT(conf, filename, max_workers);
GET_CONF_INT(conf, filename, max_clients);
+ GET_CONF_INT(conf, filename, max_queued_clients);
GET_CONF_INT(conf, filename, prio_workers);
diff --git a/daemon/libvirtd-config.h b/daemon/libvirtd-config.h
index 973e0ea..a24d5d2 100644
--- a/daemon/libvirtd-config.h
+++ b/daemon/libvirtd-config.h
@@ -63,6 +63,7 @@ struct daemonConfig {
int min_workers;
int max_workers;
int max_clients;
+ int max_queued_clients;
int prio_workers;
diff --git a/daemon/libvirtd.aug b/daemon/libvirtd.aug
index 7c56a41..70fce5c 100644
--- a/daemon/libvirtd.aug
+++ b/daemon/libvirtd.aug
@@ -56,6 +56,7 @@ module Libvirtd =
let processing_entry = int_entry "min_workers"
| int_entry "max_workers"
| int_entry "max_clients"
+ | int_entry "max_queued_clients"
| int_entry "max_requests"
| int_entry "max_client_requests"
| int_entry "prio_workers"
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 9f7fd8a..402b494 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -485,6 +485,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
NULL,
#endif
false,
+ config->max_queued_clients,
config->max_client_requests)))
goto error;
if (sock_path_ro) {
@@ -497,6 +498,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
NULL,
#endif
true,
+ config->max_queued_clients,
config->max_client_requests)))
goto error;
}
@@ -522,6 +524,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
NULL,
#endif
false,
+ config->max_queued_clients,
config->max_client_requests)))
goto error;
@@ -562,6 +565,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
config->auth_tls,
ctxt,
false,
+ config->max_queued_clients,
config->max_client_requests))) {
virObjectUnref(ctxt);
goto error;
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index af4493e..5353927 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -257,6 +257,12 @@
# over all sockets combined.
#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
# initially. If the number of active clients exceeds this,
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index c4c1727..c45f45c 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -671,7 +671,7 @@ virLockDaemonSetupNetworkingNative(virNetServerPtr srv, const char
*sock_path)
#if WITH_GNUTLS
NULL,
#endif
- false, 1)))
+ false, 0, 1)))
return -1;
if (virNetServerAddService(srv, svc, NULL) < 0) {
I think we probably want to have a non-zero backlog for virtlockd, otherwise
we could get ECONNREFUSED errors when multiple VMs start in parallel, since
each one will trigger a connect(). Probably worth making it a config file
parameter too, while you're at it.
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 124ab19..ed73ab0 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -745,6 +745,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
NULL,
#endif
false,
+ 0,
5)))
goto error;
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index a47c8f8..1739aa5 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -104,6 +104,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char
*nodename,
virNetTLSContextPtr tls,
#endif
bool readonly,
+ size_t max_queued_clients,
size_t nrequests_client_max)
{
virNetServerServicePtr svc;
@@ -129,7 +130,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char
*nodename,
goto error;
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;
/* IO callback is initially disabled, until we're ready
@@ -162,6 +163,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
virNetTLSContextPtr tls,
#endif
bool readonly,
+ size_t max_queued_clients,
size_t nrequests_client_max)
{
virNetServerServicePtr svc;
@@ -192,7 +194,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
goto error;
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;
/* IO callback is initially disabled, until we're ready
diff --git a/src/rpc/virnetserverservice.h b/src/rpc/virnetserverservice.h
index e9e5389..1143f4a 100644
--- a/src/rpc/virnetserverservice.h
+++ b/src/rpc/virnetserverservice.h
@@ -47,6 +47,7 @@ virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename,
virNetTLSContextPtr tls,
# endif
bool readonly,
+ size_t max_queued_clients,
size_t nrequests_client_max);
virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
mode_t mask,
@@ -56,6 +57,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path,
virNetTLSContextPtr tls,
# endif
bool readonly,
+ size_t max_queued_clients,
size_t nrequests_client_max);
virNetServerServicePtr virNetServerServiceNewFD(int fd,
int auth,
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|