Angshu (@angshuhere) header
Angshu (@angshuhere) profile picture

THE LAST DANCE

subjective reality
Joined November 2022
Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)Photo by Angshu (@angshuhere)
new library at our college is actually so peaceful thankfully no couples yet
14
1
119
2,645
There is still so much more, more life left to live, more love to be felt, more ppl to meet, more doors to open.
2
27
2,507
got way too many things going on rn, my energy is spread across everything and I am finishing nothing lol
5
33
713
OK I drew a rough high level workflow diagram by hand so everyone can understand what the project is about. so basically, it's kind of a banking/ledger system where we can deposit, withdraw and transfer money. right now as you can see in the diagram, we have one leader and two followers. the leader accepts client requests, let's say on port 9000 and listens for follower connections on 9001. The two followers expose their own client ports, 9010 and 9011. when a client makes a write, let's say a deposit, the leader first writes the event to its WAL on disk and updates its in-memory state. After that, it broadcasts the event to the followers and they store the replicated event in their own WAL and apply it to their own in-memory state. we can read and write from the leader, but the followers are read-only. So all writes go through the leader. so it's a a single leader replication setup. And when we restart a node, it reads its WAL and replays the events to rebuild the in-memory state(event sourcing). So even though the actual account balances are in RAM, we don't lose them after a restart because we can reconstruct them from the WAL. I haven't implemented leader failover yet. We can currently assign a new leader manually but I am working on implementing automatic leader election, where one of the followers becomes the new leader after the current leader fails.
Knot progress: So last month in august I made the mvp of this project (still need to improve a lot of things), but everything was in memory. For the past couple of days, I have been working on implementing WAL. Previously, the log and state lived only in memory, so whenever we restarted a node, it lost everything. Now added a basic WAL storage layer. Whenever a new LogEntry is committed, it gets serialized and appended to wal.log using length prefixed records. The data is flushed and synced before the write is considered successful :)
1
45
1,383
u can also try it by urself u should see something like this:
4
138
Knot progress: So last month in august I made the mvp of this project (still need to improve a lot of things), but everything was in memory. For the past couple of days, I have been working on implementing WAL. Previously, the log and state lived only in memory, so whenever we restarted a node, it lost everything. Now added a basic WAL storage layer. Whenever a new LogEntry is committed, it gets serialized and appended to wal.log using length prefixed records. The data is flushed and synced before the write is considered successful :)
4
3
1
39
2,724
winter is coming❄️
6
1
45
885
we move :)
IF I DON'T FINISH THIS I AM GAY
9
57
1,181
Wrapping up DDIA Chapter 7 about Transactions: I already knew a couple of things from DBMS and system design(arpit bhayani) so the chapter wasn't too difficult overall Started with the slippery concept of transactions and ACID, then went into the difference between single object and multi object operations and why coordinating multiple objects is important when data needs to stay consistent. Then came to the weak isolation levels. went through read committed and how it prevents dirty reads and dirty writes, snapshot isolation, repeatable read and how MVCC is used to maintain multiple versions of data to provide consistent snapshots without readers blocking writers. Also covered some of the concurrency problems that can happen even with these isolation levels, like lost updates, write skew and phantom reads. Went through different ways to prevent them using atomic operations, explicit locks, compare and set and conflict detection. And lastly got into serializable isolation and the different ways databases can achieve it(actual serial execution, 2PL, SSI)
5
40
793
उठ जाओ पार्थ वरना attendance चली जाएगी
4
1
39
1,028
First date
13
53
1,122
With butter nun😋
3
275
system design progress: - went through the circuit breaker pattern and its three states: Closed: requests go normally and failures are counted until the failure limit is reached Open: requests are rejected immediately and after a cooldown it moves to half open Half-open: allows a test request to check if the service is back. If it works it moves to Closed and if it fails it goes back to Open - implemented a basic circuit breaker in rust with axum using a post service (/post) that calls a profile service (/profile) through the circuit breaker, then tested how repeated profile service failures open the circuit, block further requests, and allow traffic again after the service recovers
6
3
162
5,986
system design progress: - covered L4 vs L7 load balancing and algorithms(round robin, weighted round robin, least connections and hash based routing) - implemented a basic load balancer in rust(axum) with multiple backend servers - read two blogs on consistent hashing
8
1
118
3,977
cargo seems to be down rn, can't download any crates :(
6
28
956
yeah it's down!
5
169
Missed one class Always late to class Always sitting on the last bench
7
37
926
Out in the village🌾
9
40
720
Knot progress: Worked on the follower node and replication flow. The follower can now connect to the leader, resume replication from its last offset, apply replicated events to its log and state, and retry the connection if the leader goes down. Also added follower side balance reads with read_after, so it can wait until it has caught up to a specific offset before returning a balance. Moved the log and state handling into a shared ledger abstraction so both the leader and follower can use the same logic. Haven’t tested the full leader follower flow yet!
7
6
123
5,827
system design progress: - went through message streaming and Kafka fundamentals: partitions, offsets, consumer groups and how Kafka works internally - implemented a kafka producer/consumer and tested partition distribution locally, did it in python before, first time trying it in Rust (assignment) - went through redis pub/sub and tested realtime broadcasting and message persistence locally (assignment) - read a really good blog about redis pub/sub, link is in the reply
13
20
461
17,812
Skipped college today, will start a new chapter on transactions already covered most of the basics in DBMS, so it shouldn’t be too difficult :)
4
48
1,250
Knot progress: Implemented the wire layer for serializing and deserializing messages over TCP. worked on the leader node and connected the different parts of the ledger together. The leader can now handle deposits, withdrawals, transfers and balance queries while keeping the append-only event log and state machine in sync. added follower replication as well, where followers can catch up on previous log entries and then receive new entries in real time through the leader's broadcast channel
Building a distributed ledger engine in rust So far, I have implemented an append only event log with offsets and support for copying events between nodes, along with a state machine that maintains account balances from events.
12
3
157
9,889