Skip to content

WebAssembly and/or Docker Cloud Code functions #7297

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

Closed
3 tasks done
sahilpohare opened this issue Mar 25, 2021 · 2 comments
Closed
3 tasks done

WebAssembly and/or Docker Cloud Code functions #7297

sahilpohare opened this issue Mar 25, 2021 · 2 comments
Labels
type:question Support or code-level question

Comments

@sahilpohare
Copy link

sahilpohare commented Mar 25, 2021

New Feature / Enhancement Checklist

Current Limitation

The current cloud functions are only limited to using Javascript as its language which limits the performance enhancements
that can be done to the functions. It also limits their usage to people with JS knowledge.

Feature / Enhancement Description

WASM

The ability to use WebAssembly cloud functions will allow lower memory usage and higher number of functions to run on
the server (Ofc depending on the quality of code and the language chosen). Also will make it usable for heavy multithreaded backend tasks. Will allow things like Tensorflow to run natively (not exactly but its close) as functions on Parse.

I know and understand that I can call C++ in nodejs but the WASM functions I am talking about will be deliverable over http API.
being able to register a WASM function with the Parse API exposed to it like in firebase.

The Second Option is Docker

Docker will bring in another set of features to parse server. The control over environment and being able to use containers as functions would be amazing. Firebase already has this with Cloud Run and AWS Lambda too.
I would love if this comes to parse in some form

Consequences

This will allow Parse to become something more than just an mBAAS and turn it into a complete serverless system.
Parse could become an aggregator for different serverless services.

Example Use Case

An example usecase would be if I wanna train a tensorflow model on parse. Like a mobile service that allows you to retrain facial detection models or language, I do not wanna expose any server code to the developer. Just the functions folder.

Alternatives / Workarounds

For Tensorflow I can always go with python-shell but that's installing dependencies inside server code and I don't like that. I like these things to be limited to the functions folder.

3rd Party References

I have seen AWS Lambda and Firebase use Docker container serverless functions. IDK about WASM though but sounds cool if WASM Functions were a thing. For Functions that dont need full fledged Virtual Environment backing it.

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Mar 26, 2021
@mtrezza
Copy link
Member

mtrezza commented Mar 26, 2021

Thanks for suggesting.

WASM is being designed to run in JavaScript VM environments and be importable like ES2015 modules. It should be possible to run WASM modules without any change in Parse Server. Parse Server is written in JS anyway, so there is no way to avoid JS unless coding Parse Server entirely from scratch as a WASM module.

If you want to transfer and execute a WASM module on the client side, e.g. the browser, this would essentially mean transferring a webpage with a <script> tag that points to a compiled WASM module. That module would be likely delivered by a CDN just like any other static content, because WASM is not supposed to be compiled on-the-fly.

Your example use case would work like this:

  1. Call Cloud Function with new training data.
  2. Cloud Function calls a JS wrapper to supply the new data to a TensorFlow WASM module.
  3. The WASM module would use low-level APIs to use GPU cores to augment the model. There is no need for anything else to be a WASM module, because the resource intensive operation is the model training.

Also, see this comment about serverlessness and Parse Server.

Can you explain in a bit more detail what you suggest to change in Parse Server?

@mtrezza mtrezza added needs more info and removed type:feature New feature or improvement of existing feature labels Mar 26, 2021
@mtrezza
Copy link
Member

mtrezza commented Apr 4, 2021

I'm closing this issue because it seems to be answered.

If you have any questions please feel free to comment and we can re-open the issue.

@mtrezza mtrezza closed this as completed Apr 4, 2021
@mtrezza mtrezza added type:question Support or code-level question and removed needs more info labels Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

2 participants