How do I implement throttle on async validators ? #647
Replies: 2 comments 3 replies
-
@varun-r-mallya : Definitely, I would recommend you to look at pub-sub example first developed by @sumanjeet0012. Wish to also recommend you to open an issue after discussion with @mystical-prog (Vraj )and @sumanjeet0012 (Sumanjeet). They will be able to guide you the best here as they are actively working on PRs focused on pub-sub and gossipsub. I'll catch up as soon as I have completed multiple meetings with multiformats team: #645 |
Beta Was this translation helpful? Give feedback.
-
@varun-r-mallya : To implement throttling on async validators in py-libp2p, you'll want to ensure that your validator functions (often called in gossipsub for pubsub message validation) don't overwhelm the system, especially if you're receiving many messages per second. Here’s a practical approach using asyncio (trio) semaphores to throttle concurrency and rate-limiting to control message processing rate.
Some notes from collaborative efforts:
Would like to hear feedback from @mystical-prog , @acul71 , @sumanjeet0012, @Khwahish29. On the same note, wish to share that go-libp2p has nice rate limiter capability. Would be nice to study it too. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/libp2p/py-libp2p/blob/main/libp2p/pubsub/pubsub.py#L585
I found this TODO lurking in pubsub and want to do something about it.
Can I have a reference implementation or atleast an idea on how to fix this ?
@seetadev
Beta Was this translation helpful? Give feedback.
All reactions