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

fix(worker_event): send large payload #11117

Closed
wants to merge 19 commits into from

Conversation

liverpool8056
Copy link
Contributor

Summary

There is a limit for the size of the payload when using worker_event lib. This limit prevent too big payload from being published through worker_event. This PR provide a solution for this case. The payload will be sent in serval smaller frame when the payload exceeds the limit, and they will be assembled at the side of the receiver.

Checklist

Full changelog

  • [Implement ...]

Issue reference

FTI-4963

liverpool8056 and others added 18 commits June 5, 2023 10:57
to be sent in events lib. In some cases, Kong needs to send big payload.
For example dao:crud rely on events to invalidate cache. In these cases,
the size of the payload may exceeds the limit due to a large dao entity.
In this PR, the `post` method of the worker_events is overwritten to
take a retry action when we get the 'payload too big' error message, and
the retry action is just to re-post the event with a truncated payload
so that the subsequent logic that relies on the event could have a
chance to be informed rather than unware at all. Based on this purpose,
the retry action is taken and only takn once when the error happens.

FTI-4963
KAG-1523
Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Chrono <chrono_cpp@me.com>
Co-authored-by: Chrono <chrono_cpp@me.com>
using worker_event lib. This limit prevent `too big` payload from
being published through worker_event. This PR provide a solution for
this case. The payload will be sent in serval smaller frame when the
payload exceeds the limit, and they will be assembled at the side of
the receiver.

FTI-4963
@chronolaw
Copy link
Contributor

It seems to be a complex solution? should we increase the limitation of lua-resty-events?
For example, increase to 2^24 - 1, i.e. 16MB?

@liverpool8056 liverpool8056 force-pushed the feature/event-payload-too-big-re-assembly branch from 1da96fe to f81fafa Compare June 26, 2023 09:44
@liverpool8056
Copy link
Contributor Author

@chronolaw glad to see that, so set this as a draft

@chronolaw
Copy link
Contributor

PR Kong/lua-resty-events#37 increase the limitatioin to 16MB, do you think it is enough?

@chronolaw chronolaw added the pr/discussion This PR is being debated. Probably just a few details. label Jun 26, 2023
@chronolaw
Copy link
Contributor

PR #11203 will replace this PR, waiting the final decision.

@liverpool8056
Copy link
Contributor Author

We made a decision to add a new parameter for specifying the limit in worker_events, referring to Kong/lua-resty-events#37, this PR can be closed.

@ms2008 ms2008 deleted the feature/event-payload-too-big-re-assembly branch July 12, 2023 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog pr/discussion This PR is being debated. Probably just a few details. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants