Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: implemented keepalive pooling in 'balancer_by_lua*'. (#38) #1908

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -81,7 +81,7 @@ install:
- git clone https://github.com/openresty/rds-json-nginx-module.git ../rds-json-nginx-module
- git clone https://github.com/openresty/srcache-nginx-module.git ../srcache-nginx-module
- git clone https://github.com/openresty/redis2-nginx-module.git ../redis2-nginx-module
- git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core
- git clone -b keepalive https://github.com/openresty/lua-resty-core.git ../lua-resty-core
- git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache
- git clone https://github.com/openresty/lua-resty-mysql.git ../lua-resty-mysql
- git clone https://github.com/openresty/lua-resty-string.git ../lua-resty-string
Expand Down
24 changes: 24 additions & 0 deletions README.markdown
Expand Up @@ -1132,6 +1132,7 @@ Directives
* [log_by_lua_file](#log_by_lua_file)
* [balancer_by_lua_block](#balancer_by_lua_block)
* [balancer_by_lua_file](#balancer_by_lua_file)
* [balancer_keepalive](#balancer_keepalive)
* [lua_need_request_body](#lua_need_request_body)
* [ssl_certificate_by_lua_block](#ssl_certificate_by_lua_block)
* [ssl_certificate_by_lua_file](#ssl_certificate_by_lua_file)
Expand Down Expand Up @@ -2597,6 +2598,29 @@ This directive was first introduced in the `v0.10.0` release.

[Back to TOC](#directives)

balancer_keepalive
------------------

**syntax:** *balancer_keepalive <total-connections>*

**context:** *upstream*

**phase:** *loading-config*

The `total-connections` parameter sets the maximum number of idle
keepalive connections to upstream servers that are preserved in the cache of
each worker process. When this number is exceeded, the least recently used
connections are closed.

It should be particularly noted that the keepalive directive does not limit the
total number of connections to upstream servers that an nginx worker process
can open. The connections parameter should be set to a number small enough to
let upstream servers process new incoming connections as well.

This directive was first introduced in the `v0.10.21` release.

[Back to TOC](#directives)

lua_need_request_body
---------------------

Expand Down
20 changes: 20 additions & 0 deletions doc/HttpLuaModule.wiki
Expand Up @@ -2186,6 +2186,26 @@ When a relative path like <code>foo/bar.lua</code> is given, they will be turned

This directive was first introduced in the <code>v0.10.0</code> release.

== balancer_keepalive ==

'''syntax:''' ''balancer_keepalive <total-connections>''

'''context:''' ''upstream''

'''phase:''' ''loading-config''

The <code>total-connections</code> parameter sets the maximum number of idle
keepalive connections to upstream servers that are preserved in the cache of
each worker process. When this number is exceeded, the least recently used
connections are closed.

It should be particularly noted that the keepalive directive does not limit the
total number of connections to upstream servers that an nginx worker process
can open. The connections parameter should be set to a number small enough to
let upstream servers process new incoming connections as well.

This directive was first introduced in the <code>v0.10.21</code> release.

== lua_need_request_body ==

'''syntax:''' ''lua_need_request_body <on|off>''
Expand Down