simperby
simperby copied to clipboard
Optimize push operation by removing duplications
Currently, git push
operation is executed by broadcast
function inDistributedRepository
module.
It is used to broadcast local changes to the remote repository, however, it is slow due to the repeated push operations.
You can see how many push operations are executed when you run cli
in cli/tests/e2e.rs
or normal_1
in simperby/tests/integration_test.rs
. As client nodes sync each other by broadcasting to the server node, they repeatedly push same local changes(agenda/agenda proof/block/fp branches).
So, we should optimize the number of push operation by storing the past pushed branches like caches.
What you should do is
- Run above tests and see how many push operations are executed during making and syncing just one block.
- Introduce appropriate data structure to store the branches that pushed.
- Change
broadcast
inrepository/interpret/push.rs
by using the new data structure. - Please check by running the same tests and see results.
Requirements
- New data structure to store the pushed branches are the member of
DistributedRepository
struct. - As local branches which will be pushed are usually attached to the most recent block, it is better to flush(remove all) the content of storage as the block height increases.
- Each remembered branches should be stored each remote repositories.
- It stores commit hashes, not branch names.