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(wasm): add support for wasmtime cache #12930

Merged
merged 2 commits into from
Jun 5, 2024
Merged

Conversation

flrgh
Copy link
Contributor

@flrgh flrgh commented Apr 24, 2024

Loading .wasm module binaries involves a compilation step before they can be executed, which can slow Kong's startup time. This enable's Wasmtime's builtin cache, such that subsequent start/stop/restart cycles can be faster with a warm cache.

See also:

KAG-4372

@github-actions github-actions bot added core/cli core/templates core/configuration cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Apr 24, 2024
@flrgh flrgh force-pushed the feat/wasm-module-cache branch 2 times, most recently from 35d459c to 945dec3 Compare May 6, 2024 23:16
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 6, 2024
@flrgh flrgh force-pushed the feat/wasm-module-cache branch 2 times, most recently from 7a5c92c to 4c9bf05 Compare May 6, 2024 23:37
@flrgh flrgh marked this pull request as ready for review May 6, 2024 23:40
@flrgh flrgh force-pushed the feat/wasm-module-cache branch 3 times, most recently from b431ca9 to 2f034f9 Compare May 20, 2024 15:56
@flrgh flrgh requested a review from brentos May 21, 2024 21:34
@brentos
Copy link
Contributor

brentos commented May 23, 2024

Is it possible to add a test for restarting kong with the cache enabled? Otherwise LGTM

@flrgh flrgh force-pushed the feat/wasm-module-cache branch from 2f034f9 to 765baba Compare May 23, 2024 17:23
@flrgh
Copy link
Contributor Author

flrgh commented May 23, 2024

@brentos

765baba adds an integration test for start/restart. There's not a lot we can inspect and assert upon without making sketchy assumptions about wasmtime's cache implementation, so this test just checks for anything in error.log that looks like a problem.

@brentos
Copy link
Contributor

brentos commented May 23, 2024

@brentos

765baba adds an integration test for start/restart. There's not a lot we can inspect and assert upon without making sketchy assumptions about wasmtime's cache implementation, so this test just checks for anything in error.log that looks like a problem.

Yeah mainly i wanted to make sure nothing broke by introducing the cache, that things work with existing cache files on restart. Thanks!

@flrgh flrgh force-pushed the feat/wasm-module-cache branch from 765baba to 296ccb5 Compare June 3, 2024 17:14
@flrgh
Copy link
Contributor Author

flrgh commented Jun 3, 2024

@locao / @kikito I could use help getting a second reviewer for this

Copy link
Contributor

@locao locao left a comment

Choose a reason for hiding this comment

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

LGTM

@flrgh flrgh merged commit 22c96a2 into master Jun 5, 2024
25 checks passed
@flrgh flrgh deleted the feat/wasm-module-cache branch June 5, 2024 16:30
@team-gateway-bot
Copy link
Collaborator

Cherry-pick failed for master, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-12930-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-12930-to-master-to-upstream
git checkout -b cherry-pick-12930-to-master-to-upstream
ancref=$(git merge-base 4052fbbfee77be52bcd5c876719a84bcbc8ba337 296ccb531a142cc5dafc428e24af60646de84372)
git cherry-pick -x $ancref..296ccb531a142cc5dafc428e24af60646de84372

@github-actions github-actions bot added the incomplete-cherry-pick A cherry-pick was incomplete and needs manual intervention label Jun 5, 2024
@flrgh
Copy link
Contributor Author

flrgh commented Jun 5, 2024

Cherry-pick failed for master, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-12930-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-12930-to-master-to-upstream
git checkout -b cherry-pick-12930-to-master-to-upstream
ancref=$(git merge-base 4052fbbfee77be52bcd5c876719a84bcbc8ba337 296ccb531a142cc5dafc428e24af60646de84372)
git cherry-pick -x $ancref..296ccb531a142cc5dafc428e24af60646de84372

Manually cherry-picked: https://github.com/Kong/kong-ee/pull/9389

@flrgh flrgh removed the incomplete-cherry-pick A cherry-pick was incomplete and needs manual intervention label Jun 5, 2024
locao pushed a commit that referenced this pull request Jun 21, 2024
* feat(wasm): add support for wasmtime cache

This adds support for Wasmtime's module caching.
See also:

* Kong/ngx_wasm_module#540
* https://github.com/Kong/ngx_wasm_module/blob/b19d405403ca6765c548e571010aea3af1accaea/docs/DIRECTIVES.md?plain=1#L136-L149
* https://docs.wasmtime.dev/cli-cache.html

* tests(wasm): add start/restart test for wasmtime cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants