Skip to content

Reduce lock contention in adding messages to mempool #5812

@LesnyRumcajs

Description

@LesnyRumcajs

Summary

There is a suspiciously long lock here

pub fn add(&self, msg: SignedMessage) -> Result<(), Error> {
self.check_message(&msg)?;
let tip = self.cur_tipset.lock().clone();
self.add_tipset(msg, &tip, false)?;
Ok(())
}

In Lotus, there are some optimisations around it.

https://github.com/LesnyRumcajs/lotus/blob/896d3c33330a75a232b8332ee9632454c1765d6d/chain/messagepool/messagepool.go#L767-L796

This would explain long running mpool tests where ~10k messages are added (which shouldn't be that much, especially on a decent hardware; but it still takes well over 30s).

Completion Criteria

  • Identify locks in the mentioned implementation and reduce the contention time.

Additional Links & Resources

Metadata

Metadata

Assignees

Labels

Type: TaskDiscrete task to implement

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions