-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(lib): increase max payload to at most 16MB #37
Conversation
@@ -82,12 +89,17 @@ function _M.send(sock, payload) | |||
return nil, err | |||
end | |||
|
|||
local bytes, err = sock:send(uint16_to_bytes(payload_len) .. payload) | |||
local data = SEND_DATA |
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.
Here I used tablepool
but remove it now.
I think that we won't get race condition, am I right?
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.
Can we just not to use the upvalue as local data = SEND_DATA
and make the data structure to be sent directly, like:
local bytes, err = sock:send({ uint_to_bytes(payload_len), payload })
I'm afraid I don't understand why you tend to use the upvalue here.
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 will create too many temporary small tables, increase the burden of gc.
Reopen if needed. |
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.
LGTM
17322ea
to
7b00d72
Compare
14aac25
to
d0a0e8c
Compare
data[1] = uint_to_bytes(payload_len) | ||
data[2] = payload | ||
|
||
local bytes, err = sock:send(data) |
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.
For the current implementation of lua-nginx-module
, I think there is no race condition on SEND_DATA
.
Just mention that changing data during the call of sock:send()
is undefined behavior, but I think it is not a blocker of this PR.
OpenAPI spec in DevPortal or updating a big config entry for plugins, they can not work as expected. With the new parameter, the user can decide the payload size to meet their needs. In this PR, a new parameter, `worker_events_max_payload` is added, which allows to specify the payload size the `worker_events` lib can accept. The default size is 64k, and the max allowed to set is 16M Bytes. The corresponding PR for `worker_events` lib is [#37](Kong/lua-resty-events#37) FTI-4963
OpenAPI spec in DevPortal or updating a big config entry for plugins, they can not work as expected. With the new parameter, the user can decide the payload size to meet their needs. In this PR, a new parameter, `worker_events_max_payload` is added, which allows to specify the payload size the `worker_events` lib can accept. The default size is 64k, and the max allowed to set is 16M Bytes. The corresponding PR for `worker_events` lib is [#37](Kong/lua-resty-events#37) FTI-4963
#11214) * With a hard-coded payload size, for some use cases like uploading a big OpenAPI spec in DevPortal or updating a big config entry for plugins, they can not work as expected. With the new parameter, the user can decide the payload size to meet their needs. In this PR, a new parameter, `worker_events_max_payload` is added, which allows to specify the payload size the `worker_events` lib can accept. The default size is 64k, and the max allowed to set is 16M Bytes. The corresponding PR for `worker_events` lib is [#37](Kong/lua-resty-events#37) FTI-4963 * add changelog entry * Update kong.conf.default Co-authored-by: Datong Sun <datong.sun@konghq.com> * add test case and bump lua-resty-events * correct the default value, and add an entry for bumping the version of lua-resty-events * 1. append PR number to the changelog entry of lua-resty-events 2. correct the spec test 3. style * Update CHANGELOG.md --------- Co-authored-by: Datong Sun <datong.sun@konghq.com> Co-authored-by: Chrono <chrono_cpp@me.com>
#11214) * With a hard-coded payload size, for some use cases like uploading a big OpenAPI spec in DevPortal or updating a big config entry for plugins, they can not work as expected. With the new parameter, the user can decide the payload size to meet their needs. In this PR, a new parameter, `worker_events_max_payload` is added, which allows to specify the payload size the `worker_events` lib can accept. The default size is 64k, and the max allowed to set is 16M Bytes. The corresponding PR for `worker_events` lib is [#37](Kong/lua-resty-events#37) FTI-4963 * add changelog entry * Update kong.conf.default Co-authored-by: Datong Sun <datong.sun@konghq.com> * add test case and bump lua-resty-events * correct the default value, and add an entry for bumping the version of lua-resty-events * 1. append PR number to the changelog entry of lua-resty-events 2. correct the spec test 3. style * Update CHANGELOG.md --------- Co-authored-by: Datong Sun <datong.sun@konghq.com> Co-authored-by: Chrono <chrono_cpp@me.com> (cherry picked from commit ff59edb)
#11214) * With a hard-coded payload size, for some use cases like uploading a big OpenAPI spec in DevPortal or updating a big config entry for plugins, they can not work as expected. With the new parameter, the user can decide the payload size to meet their needs. In this PR, a new parameter, `worker_events_max_payload` is added, which allows to specify the payload size the `worker_events` lib can accept. The default size is 64k, and the max allowed to set is 16M Bytes. The corresponding PR for `worker_events` lib is [#37](Kong/lua-resty-events#37) FTI-4963 * add changelog entry * Update kong.conf.default Co-authored-by: Datong Sun <datong.sun@konghq.com> * add test case and bump lua-resty-events * correct the default value, and add an entry for bumping the version of lua-resty-events * 1. append PR number to the changelog entry of lua-resty-events 2. correct the spec test 3. style * Update CHANGELOG.md --------- Co-authored-by: Datong Sun <datong.sun@konghq.com> Co-authored-by: Chrono <chrono_cpp@me.com>
#11214) * With a hard-coded payload size, for some use cases like uploading a big OpenAPI spec in DevPortal or updating a big config entry for plugins, they can not work as expected. With the new parameter, the user can decide the payload size to meet their needs. In this PR, a new parameter, `worker_events_max_payload` is added, which allows to specify the payload size the `worker_events` lib can accept. The default size is 64k, and the max allowed to set is 16M Bytes. The corresponding PR for `worker_events` lib is [#37](Kong/lua-resty-events#37) FTI-4963 * add changelog entry * Update kong.conf.default Co-authored-by: Datong Sun <datong.sun@konghq.com> * add test case and bump lua-resty-events * correct the default value, and add an entry for bumping the version of lua-resty-events * 1. append PR number to the changelog entry of lua-resty-events 2. correct the spec test 3. style * Update CHANGELOG.md --------- Co-authored-by: Datong Sun <datong.sun@konghq.com> Co-authored-by: Chrono <chrono_cpp@me.com> (cherry picked from commit ff59edb)
FTI-4963
KAG-1899
This PR will replace the PR Kong/kong#11117.