lun-4 / tsusu Goto Github PK
View Code? Open in Web Editor NEWproof of concept process manager written in zig (was rust)
License: MIT License
proof of concept process manager written in zig (was rust)
License: MIT License
There are two protocols in tsusu:
tsusu
client and tsusu
daemon.tsusu
threadsThe client-server protocol should be finished, as we declare the 1.0 feature set for tsusu
.
This should not happen.
Basically, tsusu stop <service>
should send a SIGINT/SIGTERM to the child process, and if both fail after some set timeout (maybe default 5 seconds, configurable later, via the service files, etc, see #6 ), SIGKILL.
PM2 provides some basic logging capabilities by itself for the services. Maybe we can do the same, since std.ChildProcess
can already catch stderr and stdout into pipes. We just need a way to communicate them into logfiles.
It would be self-written because I kinda don't know what I could do there with existing tooling.
For the daemon, it should live more on the stack. In the thread wire protocol, you can allocate unbounded memory, which isn't good, amongst other things like not freeing memory when it should be freed, etc.
As the codebase is very prototypical, this won't be pushed forward compared to getting things work.
Little design problem. Should fix that someday.
this will be a long while, so i'll keep track that this project is on hold because doing anything more requires (currently hacky when i tried to do them) changes to the stdlib that don't quite work.
there's a blocking socket module in the works which might be good enough for tsusu's usecase, until then, no work is done.
This is separate to #6 as this is on the service level.
When a service's child process exits, with any code, we should be able to automatically restart it. Compared to PM2, though, which keeps continously restarting processes at a fixed rate (which can cause havoc if you got a configuration file wrong, for example), I plan to implement exponential backoff.
The state of that restart should be made available to the daemon, I added that via the Restarting
service state. A timestamp for when the service actually starts up should be made available on that state.
Keeping note that system clock depedency for that timestamp should be done only as an informative measure. If things happen that require that data in a non-informative way, we could investigate deeper into how the monotonic clock works, and if we could show that information instead.
Got some energy to work on this, here's the plan:
ArrayList
inside the daemon process, a thread consumes from that and applies state changes, instead of the supervisors changing state directly.TODO:
strace -p
can do it, what stops us from doing so via procfs as well?tsusu config <service> get/set <key> <value>
tsusu start
PIDs for the child processes should be available in the daemon state, somehow.
The proper "thing" for this is showing CPU/RAM stats when listing services.
Followup question: what is the overhead of accessing procfs? Can that scale, even?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.