GithubHelp home page GithubHelp logo

serverless-wasm's People

Contributors

geal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-wasm's Issues

clean up error managements

the code is currently full of unwrap() and expect() calls, let's make it more robust with proper error handling

investigate environment reuse

Right now, we create an entirely new state for each request. Could we keep the environment (memory, etc) between calls to an app? What happens if we pause it to run another request to the same app? What happens if we get simultaneous calls to the same app?
Could it be better to provide a cache API that wasm apps can query?

Understanding the Vision

In my perfect world, you could launch a swarm of containers to a cloud provider and deploy multiple serverless services to that swarm. The containers and functions would all just auto-scale and optimize. I’d still want to own my container (in at least some sense) so that everything possible could be defined in standard and provider agnostic way.

I’m curious what your vision for the project is? I admit that I might not have enough bandwidth to learn and contribute, but I'm interested.

demo

with the current working version (as of commit f0e2f3e), here is how we can demonstrate the system:

  • compile the program by running cargo build (needs rust installed)
  • start the server with the configuration file: ./target/debug/serverless-wasm ./samples/config.toml
    • the configuration file maps some HTTP requests (like GET /hello) to specific functions in wasm files (samples/testfunc.wasm and samples/testbackend.wasm). The wasm files are already compiled and committed to the repository
  • do a first request with:
    • curl http://127.0.0.1:8080/hello: the server will answer Hello world from wasm!
    • curl http://127.0.0.1:8080/bonjour: the server will answer Bonjour tout le monde depuis le monde merveilleux de WASM!
    • those to endpoints are served by the testfunc project, containing two functions that build a HTTP response and send it
  • start a tcp listener on 127.0.0.1:8181 like this: nc -l -p 8181 (the port can be changed in the configuration file)
    • call the server on the remaining endpoint, served by testbackend:
      • curl http://127.0.0.1:8080/backend
      • the netcat listener will see a hello
      • if you type anything in the netcat shell and "enter", the text will be sent back as response to the client

implement `std::io::{Read,Write}` for TCP connections

there's currently a small API to open TCP connections to backend servers or databases, but it's pretty limited (returning -1 in case of errors). The host side should return different error codes that we can map to std::io::Error. Then that API will be more usable (unfortunately, most libraries still assume they will use a std::net::TcpStream or something from futures)

investigate JIT usage

the current version uses wasmi, which is a very nice interpreter, but we might want to JIT (or more precisely AOT) compile wasm modules to native code, for better performance.

Unsolved questions right now:

  • which JIT engine do we use? LLVM? Cretonne (paging @sunfishcode for this)?
  • how does wasm behaviour map to native code (see bytecodealliance/cranelift#144 for some thoughts):
    • where does the stack go?
    • how do we transform host function calls to native calls?
    • what do we do with traps?
  • how do wasm's security guarantees hold in native code? Can it access arbitrary memory locations in the process?

dispatch requests on various threads

while we're looking into async IO (see #4), it should be easier to have a thread pool to which we can give the requests to handle.
What happens to the shared state of the list of modules? Should that be hidden behind a mutex if we want to modify that list dynamically?

filesystem access

there should be a way for the apps to read and write from a FS abstraction. Maybe it would write to the local disk, maybe it would communicate with an external storage, like S3. See CommonWA/cwa-spec#3

Discuss: ABI

It actually depends on to what degree apps running under serverless-wasm should be sandboxed. One one extereme - there is only one pure function that takes input and returns output and on the other — full control of the host machine (Maybe it should be possible to just forward syscalls from wasm to kernel directly).

But the one approach that bugging me is, what if we can use cloudabi for definition of the host API. This sounds like sorta middle ground between those extremes.

This might be The Most Ambitious Crossover in History...

configure memory usage

right now the number of memory pages allocated is hardcoded, it should be possible to request a specific (maximum) amount of memory as part of the configuration for an app.

asynchronous IO

currently, TCP connections are blocking (ie, they block the whole interpreter). To have a server that handles reasonable load, we might need to have blocking IO on the wasm side, that translates to async IO on the host side.
This is doable if we have a way to pause the interpreter (see wasmi-labs/wasmi#85) and start again once we get an event on the socket.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.