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

feat(lib): increase max payload to at most 16MB #37

Merged
merged 19 commits into from
Jul 12, 2023

Conversation

chronolaw
Copy link
Collaborator

@chronolaw chronolaw commented Jun 26, 2023

FTI-4963
KAG-1899

This PR will replace the PR Kong/kong#11117.

@chronolaw chronolaw marked this pull request as ready for review June 26, 2023 11:36
@chronolaw chronolaw changed the title feat(frame): increase max payload feat(frame): increase max payload to 16MB Jun 26, 2023
@@ -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
Copy link
Collaborator Author

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?

Copy link

@liverpool8056 liverpool8056 Jul 11, 2023

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.

Copy link
Collaborator Author

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.

@chronolaw
Copy link
Collaborator Author

Reopen if needed.

@chronolaw chronolaw closed this Jul 11, 2023
@chronolaw chronolaw reopened this Jul 11, 2023
Copy link
Member

@windmgc windmgc left a comment

Choose a reason for hiding this comment

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

LGTM

@chronolaw chronolaw changed the title feat(frame): increase max payload to 16MB feat(frame): increase max payload to at most 16MB Jul 12, 2023
@chronolaw chronolaw force-pushed the feat/increase_size_of_message branch from 17322ea to 7b00d72 Compare July 12, 2023 03:53
@chronolaw chronolaw force-pushed the feat/increase_size_of_message branch from 14aac25 to d0a0e8c Compare July 12, 2023 04:10
data[1] = uint_to_bytes(payload_len)
data[2] = payload

local bytes, err = sock:send(data)
Copy link
Collaborator

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.

@chronolaw chronolaw changed the title feat(frame): increase max payload to at most 16MB feat(lib): increase max payload to at most 16MB Jul 12, 2023
@chronolaw chronolaw merged commit 8448a92 into main Jul 12, 2023
@chronolaw chronolaw deleted the feat/increase_size_of_message branch July 12, 2023 07:13
chronolaw pushed a commit to Kong/kong that referenced this pull request Jul 14, 2023
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
chronolaw pushed a commit to Kong/kong that referenced this pull request Jul 17, 2023
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
guanlan pushed a commit to Kong/kong that referenced this pull request Jul 21, 2023
#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>
team-gateway-bot pushed a commit to Kong/kong that referenced this pull request Jul 21, 2023
#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)
chronolaw added a commit to Kong/kong that referenced this pull request Jul 21, 2023
#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>
windmgc pushed a commit to Kong/kong that referenced this pull request Jul 21, 2023
#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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants