Skip to content

Commit

Permalink
Make TCP_KEEPIDLE configurable
Browse files Browse the repository at this point in the history
Addresses LP bug #1031794.

Change-Id: I9a3a6a23b1bcec5229b15234512e04cc47c3ffd9
  • Loading branch information
Stuart McLaren committed Aug 1, 2012
1 parent eeedad3 commit efb30dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/source/configuring.rst
Expand Up @@ -152,6 +152,13 @@ Number of backlog requests to configure the socket with.

Optional. Default: ``4096``

* ``tcp_keepidle=SECONDS``

Sets the value of TCP_KEEPIDLE in seconds for each server socket.
Not supported on OS X.

Optional. Default: ``600``

* ``workers=PROCESSES``

Number of Glance API worker processes to start. Each worker
Expand Down
4 changes: 4 additions & 0 deletions etc/glance-api.conf
Expand Up @@ -32,6 +32,10 @@ log_file = /var/log/glance/api.log
# Backlog requests when creating socket
backlog = 4096

# TCP_KEEPIDLE value in seconds when creating socket.
# Not supported on OS X.
# tcp_keepidle = 600

# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.
# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
Expand Down
4 changes: 4 additions & 0 deletions etc/glance-registry.conf
Expand Up @@ -18,6 +18,10 @@ log_file = /var/log/glance/registry.log
# Backlog requests when creating socket
backlog = 4096

# TCP_KEEPIDLE value in seconds when creating socket.
# Not supported on OS X.
# tcp_keepidle = 600

# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.
# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
Expand Down
4 changes: 3 additions & 1 deletion glance/common/wsgi.py
Expand Up @@ -52,6 +52,7 @@

socket_opts = [
cfg.IntOpt('backlog', default=4096),
cfg.IntOpt('tcp_keepidle', default=600),
cfg.StrOpt('cert_file'),
cfg.StrOpt('key_file'),
]
Expand Down Expand Up @@ -130,7 +131,8 @@ def get_socket(default_port):

# This option isn't available in the OS X version of eventlet
if hasattr(socket, 'TCP_KEEPIDLE'):
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE,
CONF.tcp_keepidle)

return sock

Expand Down

0 comments on commit efb30dd

Please sign in to comment.