Skip to content

Commit

Permalink
added developer section
Browse files Browse the repository at this point in the history
  • Loading branch information
marcmo committed May 21, 2024
1 parent a3a8275 commit 6e1c202
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 0 deletions.
1 change: 1 addition & 0 deletions developer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
6 changes: 6 additions & 0 deletions developer/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
authors = ["Oliver Mueller"]
language = "en"
multilingual = false
src = "src"
title = "chipmunk development journal"
1 change: 1 addition & 0 deletions developer/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Chapter 1
8 changes: 8 additions & 0 deletions developer/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Summary

[Introduction](./README.md)

- [Architecture](architecture/README.md)
- [Plugin System](plugin/README.md)
- [Wasmer](plugin/wasmer/README.md)
- [Wasmtime](plugin/wasmtime/README.md)
1 change: 1 addition & 0 deletions developer/src/architecture/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Architecture of chipmunk
4 changes: 4 additions & 0 deletions developer/src/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Introduction

This is meant as an introduction to developers who want to contribute to chipmunk.

9 changes: 9 additions & 0 deletions developer/src/plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Plugins for chipmunk

The two main WebAssembly (WASM) runtimes used in Rust are Wasmtime and Wasmer. These runtimes are popular for several reasons, largely due to their unique features, performance characteristics, and their integration with the Rust ecosystem.

Those runtimes are used in Rust due to their strong focus on portability, security, and performance. They both support WASI, enabling system-level operations in a portable way, and integrate well with the Rust ecosystem. Wasmtime is known for its simplicity and developer-friendly design, while Wasmer offers flexibility with multiple backends and comprehensive ecosystem tools like WAPM. Both runtimes are actively developed and supported by robust communities, making them reliable choices for running WebAssembly in Rust applications.

In the following we will document the experiences we had implementing a plugin-system with either of
those runtimes.

53 changes: 53 additions & 0 deletions developer/src/plugin/wasmer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Wasmer

Wasmer is another prominent runtime environment for WebAssembly (WASM), also implemented in Rust. Like Wasmtime, Wasmer allows WebAssembly modules to run outside of web browsers, enabling developers to harness the advantages of WebAssembly in diverse environments such as server-side applications, embedded systems, and desktop applications.

### Main Ideas Behind Wasmer:

1. **WebAssembly Execution**:
- Wasmer is designed to execute WebAssembly binaries efficiently and securely. These binaries, which can be generated from languages like Rust, C, C++, and more, are compact and portable.
- It provides a runtime environment that can execute these binaries consistently across different platforms.

2. **Portability**:
- Wasmer emphasizes cross-platform compatibility, allowing WebAssembly modules to run on various architectures and operating systems without modification.
- This makes it an excellent choice for developing applications that need to be deployed in heterogeneous environments.

3. **Security**:
- WebAssembly's inherent security features, such as sandboxing, are leveraged by Wasmer to ensure that executing WebAssembly code does not compromise the host system.
- This isolation ensures that potentially unsafe code cannot interfere with or damage the host environment.

4. **Performance**:
- Wasmer uses a combination of ahead-of-time (AOT) and just-in-time (JIT) compilation techniques to optimize the execution of WebAssembly code.
- These techniques translate WebAssembly modules into native machine code, providing near-native performance while maintaining portability and security.

5. **Modularity and Extensibility**:
- Wasmer supports the WebAssembly System Interface (WASI), which allows WebAssembly modules to perform system-level operations in a standardized way.
- This includes tasks such as file I/O, network communication, and process management, making it easier to develop complex applications using WebAssembly.
- Wasmer's modular design allows it to be extended and integrated with other systems and tools, providing flexibility for various use cases.

6. **Rust Ecosystem Integration**:
- Implemented in Rust, Wasmer benefits from Rust’s safety features, performance, and concurrency support.
- It integrates well with the Rust ecosystem, making it easy for Rust developers to incorporate WebAssembly into their projects.

### Unique Features of Wasmer:

- **Universal Binary Format**:
- Wasmer can convert WebAssembly modules into a universal binary format that can be executed on any platform where Wasmer is installed.
- This enhances the portability and ease of distribution of WebAssembly applications.

- **Package Management**:
- Wasmer includes a package manager called WAPM (WebAssembly Package Manager) that allows developers to distribute and share WebAssembly modules easily.
- WAPM facilitates the discovery, installation, and management of WebAssembly packages, fostering a community-driven ecosystem.

- **Multiple Execution Backends**:
- Wasmer supports multiple execution backends, including Singlepass, Cranelift, and LLVM. Each backend offers different trade-offs between compilation speed and execution performance.
- This allows developers to choose the most appropriate backend for their specific use case.

### Use Cases:

- **Serverless Computing**: Running lightweight and isolated WebAssembly functions in serverless environments for efficient resource usage.
- **Edge Computing**: Deploying WebAssembly modules at the edge to provide low-latency processing close to the data source.
- **Plugin Systems**: Enabling applications to run third-party code securely and efficiently through WebAssembly-based plugins.
- **Cross-Platform Applications**: Building applications that can run seamlessly on multiple platforms, leveraging WebAssembly’s portability.

In summary, Wasmer is a versatile and performant runtime for executing WebAssembly modules, providing robust security, portability, and integration capabilities. Its unique features, such as support for multiple backends and a package manager, make it suitable for a wide range of applications from serverless and edge computing to plugin systems and cross-platform development.
39 changes: 39 additions & 0 deletions developer/src/plugin/wasmtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Wasmtime

Wasmtime is a runtime environment for WebAssembly (WASM), implemented in Rust. It enables running WebAssembly modules outside of web browsers, allowing developers to leverage WebAssembly's portability and security in various contexts, including command-line applications, servers, and embedded systems.

### Main Ideas Behind Wasmtime:

1. **WebAssembly Execution**:
- Wasmtime is designed to execute WebAssembly binaries, which are compact, binary-encoded formats that can be produced from languages like Rust, C, and Go.
- It provides a safe and efficient execution environment for these binaries, ensuring that they can run on any platform with consistent behavior.

2. **Portability**:
- One of the key strengths of WebAssembly and Wasmtime is the ability to run code on different architectures and operating systems without modification.
- This makes it ideal for cross-platform applications and services where consistent performance and behavior are critical.

3. **Security**:
- WebAssembly's design includes strong sandboxing guarantees, which isolate the executing code from the host system, mitigating risks from untrusted code.
- Wasmtime leverages these security features, providing a robust runtime that prevents potentially malicious WebAssembly modules from affecting the host environment.

4. **Performance**:
- Wasmtime is optimized for performance, utilizing just-in-time (JIT) compilation techniques to translate WebAssembly code into native machine code at runtime.
- This approach balances the startup latency of interpretation with the execution speed of native code.

5. **Modularity and Extensibility**:
- Wasmtime supports the WebAssembly System Interface (WASI), which defines a standard for WebAssembly modules to interact with the operating system.
- This allows WebAssembly modules to perform tasks like file I/O, networking, and process management in a portable manner.
- The modular nature of Wasmtime makes it easy to extend and integrate with other systems and tools.

6. **Rust Ecosystem Integration**:
- Being implemented in Rust, Wasmtime benefits from Rust’s safety features, performance, and concurrency support.
- It can seamlessly integrate with other Rust projects, leveraging Rust's robust package ecosystem.

### Use Cases:

- **Serverless Computing**: Running WebAssembly modules in serverless platforms for quick startup times and scalability.
- **Edge Computing**: Deploying WebAssembly modules at the edge for low-latency, local processing.
- **Plugin Systems**: Allowing applications to execute third-party code safely and efficiently through WebAssembly plugins.
- **Cross-Platform Applications**: Building applications that need to run on various platforms with minimal adjustments.

In summary, Wasmtime is a powerful runtime for executing WebAssembly modules, providing portability, security, and performance across different environments. Its design and features make it suitable for a wide range of applications, from server-side computing to edge deployments.

0 comments on commit 6e1c202

Please sign in to comment.