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
base: master
Are you sure you want to change the base?
Conversation
889bcd8
to
7b8a93f
Compare
item->host.len = host->len; | ||
|
||
} else { | ||
item->host.data = ngx_pstrdup(c->pool, bp->addr_text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show check if the return value is NULL
.
ngx_sockaddr_t sockaddr; | ||
ngx_str_t host; | ||
u_char hostbuf[32]; | ||
} ngx_http_lua_balancer_ka_item_t; /*balancer keepalive item*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe ngx_http_lua_balancer_keepalive_cache_t
can be better?
to align up with ngx_http_upstream_keepalive_cache_t
.
src/ngx_http_lua_balancer.c
Outdated
ngx_http_lua_balancer_peer_data_t *bp; | ||
|
||
if (r == NULL) { | ||
*err = "no request found"; | ||
p = ngx_snprintf(errbuf, *errbuf_size, "no request found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this change?
Co-authored-by: Thibault Charbonnier <thibaultcha@me.com>
7b8a93f
to
b8f857c
Compare
README.markdown
Outdated
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.19.5` release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo here?
v0.10.19.5
-> v0.10.19
doc/HttpLuaModule.wiki
Outdated
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.19.5</code> release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
src/ngx_http_lua_balancer.c
Outdated
@@ -520,22 +860,91 @@ ngx_http_lua_ffi_balancer_set_current_peer(ngx_http_request_t *r, | |||
|
|||
if (ngx_parse_url(r->pool, &url) != NGX_OK) { | |||
if (url.err) { | |||
*err = url.err; | |||
p = ngx_snprintf(errbuf, *errbuf_size, "%s", url.err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errbuf
is undeclared before
da94e18
to
6c329ac
Compare
6c329ac
to
e340f83
Compare
src/ngx_http_lua_balancer.c
Outdated
item->host.len = host->len; | ||
|
||
} else { | ||
item->host.len = bp->addr_text->len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to move this line after line 680. just in case something changed in the feature even it doesn't for now.
src/ngx_http_lua_balancer.c
Outdated
if (n == -1 && ngx_socket_errno == NGX_EAGAIN) { | ||
ev->ready = 0; | ||
|
||
if (ngx_handle_read_event(c->read, 0) == NGX_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ngx_handle_read_event(c->read, 0) == NGX_OK) { | |
if (ngx_handle_read_event(c->read, 0) != NGX_OK) { |
src/ngx_http_lua_balancer.c
Outdated
if (ngx_memn2cmp((u_char *) &item->sockaddr, | ||
(u_char *) sockaddr, | ||
item->socklen, socklen) == 0 | ||
&& name->len == item->host.len |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should move these length compare expressions at the front?
I'm not sure if the C compiler is clever enough to do such optimizations.
src/ngx_http_lua_balancer.c
Outdated
|
||
/* | ||
* ssl name here may contain port, notably if derived from $proxy_host | ||
* or $http_host; we have to strip it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better add an example of the ssl name
value here.
This pull request is now in conflict :( |
f924579
to
fef2581
Compare
This pull request is now in conflict :( |
Any update on this issue? |
This pull request is now in conflict :( |
This pull request is now in conflict :( |
This pull request is now in conflict :( |
This pull request is now in conflict :( |
This pull request is now in conflict :( |
Co-authored-by: Thibault Charbonnier thibaultcha@me.com
I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.