[LET IT CRASH] COURSE WITH BASTION
Mahmut Bulut (@vertexclique)
Mahmut Bulut
@vertexclique on internets.
- Data Processing Engineer by day.
- Contributing the Rust core(MIRI) and other Rust projects.
- Member of the community team.
HOW PEOPLE COMMUNICATE?
- We communicate asynchronously.
- Software systems should be like how nature is.
- Communication over shared memory is not natural. (We don't write to a paper on a desk and communicate with it. Do we?)
- Failures and faults are natural. (We get sick)
HOW Rust DO ERROR HANDLING?
- We don't do much. We have error typing, not error handling.
- We write a lot of code to determine control flow in case of errors.
- We sacrifice availability and asynchrony when we don't take action on errors.
-
We always use try! or ? which creates deep error chains and recovery code.
-
Hard to maintain, especially on larger projects.
First Error Handling Code
Second Error Handling Code
ENTER DEPENDABLE SYSTEMS
error handling
≠
FAULT recovery
How FAILURES propagate?
* Fault-error-failure cascade can lead to life-threatening hazards (https://www.vlsifacts.com/defects-errors-and-faults/)
BUSINESS LOGic
Where your application's features and mission lies.
ERROR RECOVERY
Where your application's error recovery lies.
BUSINESS LOGic
Where your application's features and mission lies.
FAULT RECOVERY
Where your application's fault recovery lies.
ASYNCHRONY
Natural asynchronous communication between components.
ERROR HANDLING
Defining the application's
behavior against various errors.
BUSINESS LOGic
Where your application's features and mission lies.
FAULT RECOVERY
Where your application's fault recovery lies.
ASYNCHRONY
Natural asynchronous communication between components.
ERROR HANDLING
Defining the application's
behavior against various errors.
HOW BASTION RECOVERS ERRORS?
Through the supervisors which manage the concurrency primitives that contain business logic.
HOW BASTION RECOVERS ERRORS?
Through the callbacks which can define lifecycles of lightweight processes.
NO NEED
PLS UNWRAP
K8S is WRITTEN IN
SYSV SCRIPTS WERE GOOD
SYSTEMD IS STILL BAD
What bastion brings?
- Supervision Hierarchy and complete system.
- Natural asynchronous communication.
- Resiliency. Your application should be resilient. (e.g. your workers might fail but should recover.)
- Separation of Concerns (Error handling, asynchrony, business logic, etc.)
- Eliminate the need for wrapping your Result types.
- Eliminate the need for carrying Box<dyn Error + Send + Sync + 'static> around.
- Completely different approach to error handling.
- Writing resilient systems shouldn't be hard…
SUPERVISION HIERARCHY
UNNATURAL ASYNCRONY
- We shouldn't need the same return type for all futures.
- We shouldn't need fuse… at all.
- Streams API shouldn't have handed out elements, we should have asked for elements.
- Backpressure is not natural.
- And more…
NATURAL ASYNCHRONY
CURRENT IMPLEMENTATIONS
HOW BASTION ENVISIONS AND DOES ASYNCHRONOUS COMMUNICATION
Bastion Middleware Example: https://github.com/bastion-rs/bastion/blob/master/bastion/examples/middleware.rs
Bastion Parallel Computation Example: https://github.com/bastion-rs/bastion/blob/master/bastion/examples/parallel_computation.rs
+ INTEROPERABILITY
USE BASTION WITH ASYNC-STD
- Here we are offloading our IO-bound operations to async-std and using async/await as our interoperation guide.
- We can run side by side, without any problems.
- These are all basic examples. Bastion usage and management are completely up to you.
HOW CAN I LEARN & GET INVOLVED?
- Check out our code (https://github.com/bastion-rs/bastion)
- Join our Discord Server (https://discord.gg/DqRqtRT)
- Check out our examples (https://github.com/bastion-rs/bastion/tree/master/bastion/examples)
- Check out our Showcase repo for more integration and interop. (https://github.com/bastion-rs/showcase)
THANKS FOR LISTENING
Mahmut Bulut
@VERTEXCLIQUE
vertexclique@gmail.com
[Let It Crash] Course with Bastion
By vertexclique
[Let It Crash] Course with Bastion
- 662