jdockerty / gruglb Goto Github PK
View Code? Open in Web Editor NEWA simple L4/L7 load balancer for grugs.
A simple L4/L7 load balancer for grugs.
The tokio
ecosystem makes a lot of things simpler for async
, even though this was avoided initially for this project (by using entirely std::thread
and avoiding async
calls. Now that it is in a good-state, I can expand into changing things around for tokio
usage.
Another area to investigate is scoped threads since all threads do not have their JoinHandle
's managed, they is no call to .join()
on their usage.
At the moment the application simply quits and will instantly sever connections.
The shutdown process should be handled gracefully.
It looks like this should be easily achievable with a CancellationToken
from tokio
.
This might require a small amount of refactoring, but I envision a CancellationToken
being passed as part of the Proxy
trait, perhaps even held within self
for the Tcp|HttpProxy.proxy(...)
behaviour, rather than calling it from TcpProxy::proxy(...)
instead?
I believe there are some "better" alternatives to using a Mutex
around the std::collections::HashMap
, this will need some testing/investigation though.
A quick cursory search leads to:
Either of these could be useful in simplifying the locking of the HashMap
for healthy targets.
There has been an external recommendation on dashmap
, but also consider using RwLock
if I can deem that the number of updates comparative to reads is fairly small.
At the moment, anyhow
is being used as an easy way to use the ?
operator from within functions, with relatively minimal error handling and customisation.
Expanding on this to return customised errors which are relevant to the flow would be hugely useful in debugging and also providing a .with_context(...)
to what happened.
The accept_tcp
and accept_http
functions are very similar, their common use can be pulled into a trait
and have both http/tcp satisfy the trait implementation.
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.