mats3
design
mats3 | design | |
---|---|---|
20 | 34 | |
59 | 11,350 | |
- | 0.2% | |
8.7 | 3.9 | |
6 days ago | 13 days ago | |
Java | ||
GNU General Public License v3.0 or later | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mats3
-
Flawless – Durable execution engine for Rust
The “restart from where it failed”-aspect was a big reason for why I made Mats3. It is message-based, async, transactional, staged stateless services, or message-oriented asynchronous RPC. Due to the transactionality, and the “state lives on the wire”, if a flow fails, it can be restarted from where it left off.
https://mats3.io
-
A Modern High-Performance Open Source Message Queuing System
I am truly finding it hard to explain it. I have tried along a dozen angles. I actually think it is a completely new concept - and that might be the problem.
There is an illustration on the front-page: https://mats3.io/
Here's a set of small answers to "What is Mats?": https://github.com/centiservice/mats3/blob/main/README.md#wh...
Here's a way to code up Mats3 endpoints using JBang and a small toolkit which makes it extremely simple to explore the ideas: https://github.com/centiservice/mats3/blob/main/README.md#wh...
If you read these and then get it, I would be extremely happy if you gave me a sentence or paragraph that would have led you to understanding faster!
The use of JMS is just a transport. I could really have used anything, incl. any MQ, or ZeroMQ, or plain TCP - or just a shared table in a database.
Wrt. WebSockets, that is a transport typically between a server, and a end-user client, e.g. an iOS App. Actually, there's also a "sister project", MatsSockets, that bring the utter async-ness of Mats3 all the way out to the client, e.g. a webpage or an app. https://matssocket.io/
NATS is just a message queue, with some ability to orchestrate. I do not like this concept of orchestration as an external service, that is one of the founding ideas of Mats3: Do the orchestration within each service, as you would do if you employed REST as the ISC mechanism.
-
JBang + Spring + Mats3: Setting up a multi-stage Async Messaging-based Endpoint in very few lines
Read more about mats3 here: https://mats3.io/
-
Where is the "router"? on the client or MOM side?
I've made a Java library to facilitate the latter. https://mats3.io/ - you can start reading here: https://mats3.io/docs/message-oriented-rpc/, or test out some code right away, using JBang, here: https://mats3.io/explore/jbang-mats/
- Messaging with a call stack: Async inter-service "RPC" with arbitrary call depth featuring "local variables" on a stack.
- A detailed comparison of REST and gRPC | Kreya
-
Mats3 with JBang: An exploration of Message-Oriented Async RPC with self-contained java programs
I have explained about this on the frontpage of Mats3: https://mats3.io/, and more in-depth in the first step of the "Walkthrough": https://mats3.io/docs/message-oriented-rpc/ - and even more into it at "Rationale for Mats", here: https://mats3.io/background/rationale-for-mats/
-
JBang and Mats3: Explore Mats3 Message-Oriented Async RPC with JBang “Java Exec”
JBang’s tagline: “Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.”
Mats3’s tagline: “Message-Oriented Async RPC. Message-based Interservice Communication made easy! Naturally resilient and highly available microservices, with great DevX and OpsX.”
JBang is a cool "execute single Java source file with dependencies" solution, which offers a simple way to test new libraries. The article tries to showcase Mats3's core concepts through a series of JBang scripts.
To streamline the process, a small library called 'MatsJbangKit' has been developed, which not only takes care of pulling up the Mats infrastructure but also depends on all the necessary dependencies. This means users only need to reference this single library in their JBang scripts. The aim is to pique curiosity and inspire further exploration of Mats3 and its potential.
If you like it, a star on Github would be much appreciated: https://github.com/centiservice/mats3
-
Why messaging is much better than REST for inter-microservice communications
This is a "tack on"-tool to the otherwise fully async nature of Mats/messaging.
> For this to really work well, the message passing has to be integrated with the CPU dispatcher
It sounds like you are 100% set on speed. This is not really what Mats is after - it is meant as a inter-service communcation system, and IO will be your limiting factor at any rate. Mats sacrifices a bit of speed for developer ergonomics - the idea is that by easily enabling fully async development of ISC in a complex microservice system, you gain back that potential loss from a) actually being able to use fully async processing (!), and b) the inherent speed of messaging (it is at least as fast as HTTP, and you avoid the overhead of HTTP headers etc.
It is mentioned here, "What Mats is not": https://github.com/centiservice/mats3#what-mats-is-not
- Mats3: Message-Oriented Async Remote Procedure Calls
design
-
Rust, WASM, and LOK
First of all, a quick rundown of what WASM is. It stands for Web Assembly. In essence, similar to how Java compiles down to a bytecode that is interpreted by a Java Virtual Machine, Web Assembly is a different bytecode interpreted by the browser. Many different languages can compile into WASM, and Javascript can interface with it like a module. In my case, I wrote a lot of the source code in Rust and compiled it down to a WASM module, then called into it from Javascript.
-
Surprisingly Powerful – Serverless WASM with Rust Article 1
WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications. - https://webassembly.org
-
Reaching and surpassing the limits of JavaScript BigData with WebAssembly
With WebAssembly we can compile our C++ codebase into a wasm module for the browser. So when you look at a SciChart.js chart you're actually seeing our C++ graphics engine wrapped for JavaScript.
-
WASM Instructions
I should add, however, that the unmentioned elephant in the room is V8 JIT (TurboFan), which simply doesn't handle irreducible control flow. While there are some valid theoretical arguments around the current arrangement in Wasm, looking at the history of the associated discussions makes it pretty obvious that having V8 support Wasm and generate fast code similar to what it can do for asm.js was an overriding concern in many cases. And Google straight up said that if Wasm has ICF, they will not bother supporting such cases, so it will be done by a much slower fallback:
https://github.com/WebAssembly/design/issues/796#issuecommen...
AFAIK no other Wasm implementation has the same constraint - the rest generally tend to desugar everything to jumps and then proceed from there. So this is, at least to some extent, yet another case of a large company effectively forcing an open standard to be more convenient for them specifically.
-
Supercharge Web AI Model Testing: WebGPU, WebGL, and Headless Chrome
https://github.com/WebAssembly/design/issues/1397
> Currently allocating more than ~300MB of memory is not reliable on Chrome on Android without resorting to Chrome-specific workarounds, nor in Safari on iOS.
That's about allocating CPU memory but the GPU memory situation is similar.
-
Build your own WebAssembly Compiler
As far as I can tell (5 minutes of internet research) this was to allow easier compilation to JavaScript as a fallback in the days when WASM wasn't widely supported.
"Please add goto" issue has been open since 2016:
https://github.com/WebAssembly/design/issues/796
Most interesting comment:
> The upcoming Go 1.11 release will have experimental support for WebAssembly. This will include full support for all of Go's features, including goroutines, channels, etc. However, the performance of the generated WebAssembly is currently not that good.
> This is mainly because of the missing goto instruction. Without the goto instruction we had to resort to using a toplevel loop and jump table in every function. Using the relooper algorithm is not an option for us, because when switching between goroutines we need to be able to resume execution at different points of a function. The relooper can not help with this, only a goto instruction can.
> It is awesome that WebAssembly got to the point where it can support a language like Go. But to be truly the assembly of the web, WebAssembly should be equally powerful as other assembly languages. Go has an advanced compiler which is able to emit very efficient assembly for a number of other platforms. This is why I would like to argue that it is mainly a limitation of WebAssembly and not of the Go compiler that it is not possible to also use this compiler to emit efficient assembly for the web.
^ https://github.com/WebAssembly/design/issues/796#issuecommen...
-
Flawless – Durable execution engine for Rust
When I implemented a WASM compiler, the only source of float-based non-determinism I found was in the exact byte representation of NaN. Floating point math is deterministic. See https://webassembly.org/docs/faq/#why-is-there-no-fast-math-... and https://github.com/WebAssembly/design/blob/main/Nondetermini....
-
Requiem for a Stringref
> To work with GC, you need some way to track if the GC'd object is accessible in WASM itself.
I've never heard of a GC with that kind of API. Usually any native code that holds a GC reference would either mark that reference as a root explicitly (eg. https://github.com/WebAssembly/design/issues/1459) or ensure that it can be traced from a parent object. Either way, this should prevent collection of the object. I agree that explicitly checking whether a GC'd object has been freed would not make any sense.
> The reason why you probably need a custom string type is so you can actually embed string literals without relying on interop with the environment.
WASM already has ways of embedding flat string data. This can be materialized into GC/heap objects at module startup. This must happen in some form anyway, as all GC-able objects must be registered with the GC upon creation, for them to be discoverable as candidates for collection.
Overall I still don't understand the issue. There is so much prior art for these patterns in native extensions for Python, PHP, Ruby, etc.
-
The Tug-of-War over Server-Side WebAssembly
Giving you a buffer that grows is the allocation approach I am talking about. This is not how your OS works. Your OS itself works with an allocator that does a pretty good job making sure that your memory ends up not fragmented. Because WASM is in between, the OS is not in control of the memory, and instead the browser is. The browser implementation of "bring your own allocator" is cute but realistically just a waste of time for everybody who wants to deploy a wasm app because whatever allocator you bring is crippled by the overarching allocator of the browser messing everything up.
It seems like the vendors are recognizing this though, with firefox now having a discard function aparently!
https://github.com/WebAssembly/design/issues/1397
- How do Rust WebAssembly apps free unused memory?
What are some alternatives?
blazingmq - A modern high-performance open source message queuing system
content - The content behind MDN Web Docs
OpenMAMA - OpenMAMA is an open source project that provides a high performance middleware agnostic messaging API that interfaces with a variety of proprietary and open source message oriented middleware systems.
wave - Realtime Web Apps and Dashboards for Python and R
cadence - Cadence is a distributed, scalable, durable, and highly available orchestration engine to execute asynchronous long-running business logic in a scalable and resilient way.
interface-types
ntf-core - Sockets, timers, resolvers, events, reactors, proactors, and thread pools for asynchronous network programming
Chevrotain - Parser Building Toolkit for JavaScript
mosquitto - Eclipse Mosquitto - An open source MQTT broker
WASI - WebAssembly System Interface
ZeroMQ - ZeroMQ core engine in C++, implements ZMTP/3.1
iswasmfast - Performance comparison of WebAssembly, C++ Addon, and native implementations of various algorithms in Node.js.