-
Notifications
You must be signed in to change notification settings - Fork 13
backend architecture #65
Comments
@kitzbergerg Did you already read through the whole backend code? Are there obvious improvements? |
I haven't looked into it in detail, but I noticed a few things. How do we want to handle that? Can I just start and change the code how I think it would make sense and book it to either this ticket or #60. While doing so I would also create a style guide. Although I'll try to mostly use clippy lints. For a higher level overview we could use https://github.com/rust-lang/mdBook and for code documentation |
"Obvious" improvements (like making code shorter/more readable/...) you can directly do (simply create PR(s)). For bigger restructuring it is needed to first create architecture/docu/decisions so that I can give my okay first.
Sounds good to me! 🚀 |
@markus2330 Is there a reason why we use routes instead of macros (see https://actix.rs/docs/getting-started). Otherwise I might refactor that as well in a sensible way. |
I don't think there is a special reason for this. (@buenaflor?) Feel free to refactor if it leads to easier comprehensible code. |
Do we want path normalization? (See https://actix.rs/docs/url-dispatch#path-normalization-and-redirecting-to-slash-appended-routes) Currently there we get 404 if we call e.g. |
@kitzbergerg If it doesn't cost performance or doesn't require much additional code it is handy for manual testing (when using curl etc.). |
Another thing I noticed is that diesel is not async. So every call to the database blocks a thread in actix's/tokio's executor. Unless there is a good reason to use diesel in combination with actix we might want to consider switching to an async sql/postgres crate. I have heard some good things about sqlx. This however need further investigation. Unless PermaplanT should really be able to scale with lots of concurrent connections this probably doesn't make a difference. |
Just found this: https://github.com/actix/examples/blob/f8e3570bd16bcf816070af20f210ce1b4f2fca69/diesel/src/main.rs#L64-L70. Maybe I can build something out of that (although that seems a lot more complicated than just using a different crate). There is also a lot of discussion here about async diesel: diesel-rs/diesel#399. |
According to actix doc we should use |
Thank you, these are great investigations!
If PermaplanT gets successful, we hopefully have to deal with many concurrent connections. Uptime is most important (no crashes, no restarts etc.), good performance is 2nd most important non-functional goal (after UI related goals in README.md). These non-functional goals specific to the backend should be also part of the mdBook.
Can you please write a decision for the compile-time checked queries in doc/decisions. Just that we have documented pros/cons of Diesel and alternatives. Changing to sqlx is not totally off the table if it really is strongly superior. The main questions are if it also supports migrations and postgis datatypes like Diesel does (https://lib.rs/crates/postgis_diesel).
These two ways should also be listed as possibilities in the decision. |
@markus2330 I think we can close this in favour of #158. |
We should have full architecture description of how the code in the backend should be structured.
Please use arc42 and a similar style as already started (and also used in Elektra) with Markdown files per chapter.
The text was updated successfully, but these errors were encountered: