trillium-rs / trillium

Trillium is a composable toolkit for building internet applications with async rust
https://trillium.rs
Apache License 2.0
339 stars 18 forks source link

max-connections/backpressure/load-shedding #9

Open jbr opened 3 years ago

jbr commented 3 years ago

Logic for when the server is overwhelmed, like backpressure or load shedding. Potentially since we have a count of the number of open connections, we can also set a maximum number of connections and choices for what to do when that threshold is met (put them in a queue or just respond immediately with an error). This is not essential now, but I think it's valuable to be able to point to mature features like this when communicating with people assessing this as a framework to build on.

jalcine commented 2 years ago

What kind of work would be required for this? I started looking into making multiple workers for my site but then I wondered if this exists and handled here.

(Originally published at: https://jacky.wtf/2022/7/olbk)

jbr commented 2 years ago

In the short term, what specific behavior are you looking for? I think part of the reason I punted on this is that there are so many valid different use cases / needs, and it's unclear what the "80% shared behavior" is. Currently the only degradation is that trillium sheds connections with a pre-rendered http response when we are close to max connections (which defaults to ulimit but can be configured on the server adapter Config)