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

Conversation

zhuizhuhaomeng
Copy link
Contributor

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.

@zhuizhuhaomeng zhuizhuhaomeng force-pushed the keepalive_pool branch 2 times, most recently from 889bcd8 to 7b8a93f Compare August 19, 2021 06:25
item->host.len = host->len;

} else {
item->host.data = ngx_pstrdup(c->pool, bp->addr_text);
Copy link
Member

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*/
Copy link
Member

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.

ngx_http_lua_balancer_peer_data_t *bp;

if (r == NULL) {
*err = "no request found";
p = ngx_snprintf(errbuf, *errbuf_size, "no request found");
Copy link
Member

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?

doujiang24
doujiang24 previously approved these changes Sep 3, 2021
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.
Copy link
Contributor

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

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errbuf is undeclared before

item->host.len = host->len;

} else {
item->host.len = bp->addr_text->len;
Copy link
Member

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.

if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
ev->ready = 0;

if (ngx_handle_read_event(c->read, 0) == NGX_OK) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ngx_handle_read_event(c->read, 0) == NGX_OK) {
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {

if (ngx_memn2cmp((u_char *) &item->sockaddr,
(u_char *) sockaddr,
item->socklen, socklen) == 0
&& name->len == item->host.len
Copy link
Member

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.


/*
* ssl name here may contain port, notably if derived from $proxy_host
* or $http_host; we have to strip it
Copy link
Member

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.

@mergify
Copy link

mergify bot commented Sep 20, 2021

This pull request is now in conflict :(

@mergify
Copy link

mergify bot commented Mar 5, 2022

This pull request is now in conflict :(

@Triple-Z
Copy link
Contributor

Any update on this issue?

@mergify mergify bot removed the conflict label Mar 20, 2023
@mergify
Copy link

mergify bot commented Mar 20, 2023

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Mar 20, 2023
@mergify mergify bot removed the conflict label May 10, 2023
@mergify
Copy link

mergify bot commented May 10, 2023

This pull request is now in conflict :(

@mergify mergify bot added the conflict label May 10, 2023
@mergify
Copy link

mergify bot commented Jul 20, 2023

This pull request is now in conflict :(

@mergify mergify bot removed the conflict label Sep 23, 2023
@mergify
Copy link

mergify bot commented Sep 23, 2023

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Sep 23, 2023
@mergify mergify bot removed the conflict label Mar 6, 2024
Copy link

mergify bot commented Mar 6, 2024

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants