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

[draft]proposal: run services on wasm #610

Closed
seeflood opened this issue May 26, 2022 · 9 comments
Closed

[draft]proposal: run services on wasm #610

seeflood opened this issue May 26, 2022 · 9 comments
Labels
stale wasm WebAssembly technology

Comments

@seeflood
Copy link
Member

seeflood commented May 26, 2022

I propose that we compile micro-services into wasm modules and run them on wasm runtime.
These services should be smaller than traditional micro-services. Maybe we can call them "nano-service".
image

We can assume that there's only one Layotto on one node:

image

  • How to "shrink to zero" when no request comes
    Layotto runtime should monitor the workload of every wasm module. If the workload of service 2 decrease to zero, wasm runtime should offload the wasm module, or "swap the module to disk", so that the module won't consume memory.
    The offload mechanism should be transparent to K8s. In k8s view, there's still a service 2 running on this node.

  • How to "cold start" when new request comes
    If new requests come after "swapping to disk", Layotto runtime should:

    • hold the request
    • load the wasm module
    • and then forward the request to the module.
  • How to "scale out" on one node
    a. Raise the resource limits of service 2
    b. Load another service_2.wasm

  • How to "scale out" to run service 2 on more nodes
    Layotto should report metrics of service 2 to K8s, and it's K8s' business to decide whether to scale out to a new node.

  • Milestones
    At first ,we can run another preview service on wasm

@zhenjunMa
Copy link
Contributor

What's the differences between a "nano-service" and a "function"?

@nobodyiam
Copy link
Member

What's the differences between a "nano-service" and a "function"?

Looks like they are quite similar concepts.

@seeflood
Copy link
Member Author

seeflood commented May 28, 2022

This proposal is an idea for discussion. We need some ideas on "what's the next step of layotto+ wasm" :)

What's the differences between a "nano-service" and a "function"?

A service is "a group of functions" , like a pod is a group of containers. For example:

  • a service might export 20 rpc endpoints
  • these endpoints share same memory and connections
  • this "group of functions" is the minimum scheduling unit
  • the computing model is "long-running service" , instead of "instantaneous function", so that we don't have to work on hard things like "How to adapt the function model to k8s", "how to write another layer of scheduler", "how to do function orchestration"

@kevinten10
Copy link
Member

Sounds like function + layotto as daemonset

this "group of functions" is the minimum scheduling unit

How about step function, and then deploy layotto as daemonset to serve the group.

@seeflood
Copy link
Member Author

How about step function, and then deploy layotto as daemonset to serve the group.

Do you mean aws step function ? I didn't know it. Let me learn and play it :P

@rayowang
Copy link
Member

rayowang commented May 29, 2022

This is a good proposal. As said in the community meeting yesterday, whether it is an independent faas model or a nano-service model, I think both have great practical business value. As we all know, the former has many practical applications, such as Alibaba Cloud Function Compute. The latter will have higher practical value in search, recommendation, advertising and other businesses that require large-scale resources.

However, when it comes to resource isolation, I personally think that it is relatively certain that each wasm must have a certain degree of isolation, because it is necessary to ensure overall security and stability.

But for the resource problem of each layotto, in other words, how many layotto should a node deploy, more precisely in one or more ways such as container runtime, deamonset, microservice framework, etc., I think we need discuss further.

@seeflood seeflood added the wasm WebAssembly technology label Jun 4, 2022
@github-actions
Copy link

github-actions bot commented Jul 5, 2022

This issue has been automatically marked as stale because it has not had recent activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue or help wanted) or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 5, 2022
@github-actions
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue or help wanted. Thank you for your contributions.

@seeflood
Copy link
Member Author

seeflood commented Oct 4, 2022

I just found that cloudflare open sourced their serverless runtime project "workerd" . They call their abstraction "nanoservice" too. Interesting 😆

image

https://github.com/cloudflare/workerd
https://blog.cloudflare.com/workerd-open-source-workers-runtime/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale wasm WebAssembly technology
Projects
None yet
Development

No branches or pull requests

5 participants