234 points by rustybob 6 months ago flag hide 12 comments
johnwashere 6 months ago next
Nice job! I've been wanting to learn Rust and this seems like a great project to study. Any resources or tips you would recommend for a Rust beginner?
h4ck3rm4n 6 months ago next
I recommend checking out the Rust book (<https://doc.rust-lang.org/book/>) to start with basics and learn about the language's details and best practices. Once you have the basics covered, following some tutorials and open-source projects would be very helpful to see how things are done in real projects.
lintking13 6 months ago prev next
That's awesome. Did you find the Apache2 and MIT licences to be an easy choice, Rust already has such extensive libraries to build on?
devnull101 6 months ago next
Those licenses were a natural fit for my project due to compatibility with other libraries I needed. However, keep in mind your specific project requirements and choose accordingly. There are plenty of libraries for Rust to work with, and it can be easy getting started with the ones you choose, but the community and third-party contribution is still growing. Be prepared to have to build a bit from scratch depending on your needs.
programminpete 6 months ago prev next
I am curious to know more about the performance. How does it compare to other decentralized networks that you have tried? There are not many benchmarks in this area.
t3chn0m4n 6 months ago next
It's hard to make direct comparisons as every decentralized network has its own characteristics, but Rust's speed, memory safety, and lack of runtime certainly deliver a better performance than most would have with similar configurations. Plus, Rust's syntax and conventions are quite to my liking when it comes to concurrent programming, which was essential for making the social network decentralized and fast.
rustyl0g1c 6 months ago prev next
From the project images, it looks very well designed and tidy. Great work on the UI, and the functionality seems well thought through. Did you use any generators or just roll your components one by one? I am interested in how much of the UI was made manually and any tools you might have used.
d3vgirl 6 months ago next
Thanks! I'm glad you like it. I leaned towards manually building most of the components, but for routine tasks, I found Yew (<https://yew.rs/>), a modern front-end framework for Rust, to be incredibly helpful. You can also try out other Rust UI libraries such as iced (<https://iced.rs/>) for your next project. But I wanted to keep things simple, so I avoided using any CSS frameworks or over-relying on third-party libraries.
j0nnybr00d3 6 months ago prev next
Very impressive! To confirm, you also built your own distributed storage for the data as well, right? Any lessons learned you would share about that part? Any tips on how you approached the data replication/partitioning question to maintain the speed and consistency? How is it handling with larger numbers of simultaneous users?
decentraldev 6 months ago next
Thank you! Yes, I used IPFS with watching enabled interconnected with a custom-built distributed hash table for metadata storage across the nodes in the network. Lesson learned: designing the custom hash table was a challenge. I focused on consistent hashing with a balanced and efficient distribution of data to avoid hotspots and load imbalance among nodes. For data replication, I used a master-slave topology with a leader election algorithm and redundancy parameters on nodes to accurately manage consistent data replication. Finally, on the matter of larger numbers of simultaneous users: since each node replicates and manages its own user-base, it does quite well, as long as there is adequate horizontal scaling.
r4wkt3r 6 months ago prev next
This is off the topic but, did you ever encounter cargo build taking longer time randomly or maybe I should create a new post...
cargotamer 6 months ago next
I've observed such issues too in Cargo, but there are approaches to improve compilation times. 1. Use `--release` to take advantage of LLVM's optimizations for faster builds. 2. Employ dependency resolution tools like `cargo-udeps` for simplifying dependency graphs. 3. If you're iterating locally, try tools like `cargo-watch` so that incremental builds track file changes and ensure timely compilation. 4. Enable parallel compilation with `--jobs`. These tips should save you some time when working with Cargo.