-
Notifications
You must be signed in to change notification settings - Fork 3
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
🎁 Pretty print cloud events via wasm #24
🎁 Pretty print cloud events via wasm #24
Conversation
Conflicts fixed: - quarkus/src/main/java/com/redhat/openshift/knative/showcase/events/Endpoint.java
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cardil The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
9dbea4c
to
b4022df
Compare
cf0d62f
to
3c6191d
Compare
3c6191d
to
ef4aff1
Compare
ef4aff1
to
bff8677
Compare
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.
@cardil Hey, I have just put a few comments to get some clarification.
I'm not familiar with WASM but I suppose the code that actually does the formatting of the received cloud events is not in this PR. It's somewhere external? Looks like this PR loads and calls the WASM modele that was created somewhere else.
* @callback Log | ||
* @param {string} message | ||
* @param {...any} args | ||
*/ |
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.
Does this belong to any function? If not, let's remove it.
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 is used on line 69. This is done, so you get a code assist in IDE, like vscode.
const tmpDir = os.tmpdir() | ||
const tmp = await fs.mkdtemp(`${tmpDir}/wasm-oci-`) | ||
const reg = new WasmRegistry(tmp) | ||
const image = Image.parse('quay.io/cardil/cloudevents-pretty-print@sha256:134269c7090bcb923d8b8764920bb25923e38411413eac7e4240524f1a40dc74') |
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.
If I understand it correctly, you created the cloudevents-pretty-print.wasm in advance, then put it in the image above and the application is now pulling the image and consuming the wasm file from it?
Where/how was the cloudevents-pretty-print.wasm created? Where's the code?
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.
Yes. The code is here: https://github.com/cardil/cloudevents-pretty-print
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.
I didn't put the whole WASM project in this repo, so not to cloud the project even more. I could transfer it to https://github.com/openshift-knative org, if you think it's a good idea.
However, I doubt the code in https://github.com/cardil/cloudevents-pretty-print will change in any significant way, so I don't know is that worth it.
@@ -105,6 +110,16 @@ | |||
<artifactId>frontend</artifactId> | |||
<version>main</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.redhat.openshift.knative.showcase</groupId> | |||
<artifactId>cloudevents-pp-wasm</artifactId> |
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.
Where's the source code for this dependency?
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.
The code is here: https://github.com/cardil/cloudevents-pretty-print (in Rust). It gets built onto a WASM module, and published on quay.io/cardil/cloudevents-pretty-print
The script in frontend app, downloads that WASM module from the registry, and packages it as jar onto local ~/.m2
directory.
That's done, so it is easily available for Java app (same as web files were provided before)
Hi @cardil , it's good to see WASM in action and how it can be glued together. Thanks for that. The code looks good but it also brings huge complexity to this showcase application that doesn't pay off. If I exclude the package-lock.json from my consideration it's still about 400 lines of glue code just to load and use the WASM module. This source code of this WASM module is also in a different repository, written in a different language and also pulled through an image that was published to your own image registry (the personal registry is a minor details, the complexity of pulling this through image will remain when moving under openshift-knative/showcase). The actual code that does the formatting of the cloud event is just about 40-50 lines in RUST and as you said it's not likely that this code will change much. Personally, I'd prefer writing this formatting of event in both Java and JS - for both backends separately, or maybe do it on frontend that is shared by both backends. Even if loading a WASM module is quick it can hardly show the effect with this short event formatting stuff. It would be more reasonable for big libraries being loaded. I'd prefer if someone else could give their opinion as well before merging this. |
Thanks, @cardil, for this experiment, it looks interesting and might pave the way for future experimentation with WASM (e.g., how to put a runtime best in the image). However, I think we should not add this to this showcase image. Let me explain why:
@cardil, sorry that I don't have a more positive answer. I definitely see the value in experimenting and learning new technologies like WASM. Still, only because we have (supposedly) a new golden hammer doesn't mean everything is now a nail. We can consider moving this experimentation to another playground. One example that I see is to try to get the queue-proxy functionality into a WASM module that can be used as Dapr middleware. I think this is more natural instead of adding a user-invisible addition of implementation details that adds more dependencies (the WASM deps are not even 100% stable, I would guess) and does not have any benefits when it comes to maintenance. |
I'll prepare simpler implementation /close |
@cardil: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Thanks @cardil |
Changes
Fixes #15
Found issues
GLIBC_2.32
not found) quarkusio/quarkus-images#227