Skip to content

NishikiChisato/MIT6.5840

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT6.5840

MIT6.5840(6.524): Distributed Systems(Spring 2023)

Progress

  • Lab 1
  • Lab 2
    • Lab 2A
    • Lab 2B
    • Lab 2C
    • Lab 2D
  • Lab 3
    • Lab 3A
    • Lab 3B
  • Lab 4
    • Lab 4A
    • Lab 4B

Illustration

Complete accuracy of code cannot be guaranteed due to the randomness of execution. Basically, we can nearly all pass unit tests from 2A to 2D over 500 times, and there are only failed tests occurred.

PAY ATTENTION that only when we have commented raft.go line 787, we can pass unit tests 2B.

$ dstest -s -p 20 -n 500 2A 2B 2C 2D
┏━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Test ┃ Failed ┃ Total ┃          Time ┃
┡━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━┩
│ 2A   │      0 │   500 │  13.82 ± 0.51 │
│ 2B   │      0 │   500 │  34.72 ± 1.70 │
│ 2C   │      1 │   500 │ 130.59 ± 5.68 │
│ 2D   │      0 │   500 │ 137.03 ± 3.47 │
└──────┴────────┴───────┴───────────────┘

Test

We take lab2 as an example. Firstly, write the following two files to /usr/local/bin and saved them as dslogs and dstest, resepctively. You can go into util.go and set debug to allow logs to be open or not.

#!/bin/bash
if [ $# -eq 0 ]; then
    exit 1
fi
python3 /path/to/your_directory/src/raft/dslogs.py $@
#!/bin/bash
python3 /path/to/your_directory/src/raft/dstest.py $@

Also bear in mind that change these file mods to executable. dslogs.py and dstest.py are provided by Lab Instruction.

The variable debug in util.go controls whether or not logs are output. You can input dslogs --help or dstest --help to get ideas of how to use it.

In auxiliary.go, The function WriteLog can be used to examine which logs have been applied for different servers. If you want to use it, please uncomment logDebuger in raft.go

Profiling

go test -cpuprofile cpu.prof -memprofile mem.prof -bench .

If you want to generate Flame Graph, you can(use this repository):

go tool pprof -raw -output=cpu.txt cpu.pprof
./stackcollapse-go.pl cpu.txt > out.folded
./flamegraph.pl out.folded > out.svg

QPS

We can use tests framework of lab3 to check the QPS of Raft:

go test -run TestQPS
servers: 3, clients: 12
Test: snapshots, random keys, many clients (3B) ...
  ... Passed --  15.8  3 318004 95847
PASS
ok  	6.5840/kvraft	15.901s

About

MIT6.5840 source code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published