ethereum / alexandria

MIT License
6 stars 9 forks source link

Detect when advertisement is bottleneck #6

Open pipermerriam opened 4 years ago

pipermerriam commented 4 years ago

Currently advertisement of content attempts to broadcast content once ever KADEMLIA_ANNOUNCE_INTERVAL. With a big enough content database, the advertisement queue will lag behind. We should detect this and report it as a warning condition.

staccDOTsol commented 1 year ago

Detecting when the advertisement becomes a bottleneck due to a lagging advertisement queue is an important consideration for optimizing content distribution. One approach to address this issue is by implementing a monitoring mechanism that tracks the rate at which content is being broadcasted and compares it to the rate at which new content is being added to the database.

To detect the bottleneck, you can periodically check the size of the advertisement queue and compare it to the rate of content addition. If the queue size consistently grows over time, while the rate of content addition remains high, it could indicate a potential bottleneck. You can set a threshold value for the queue size, and if it exceeds that threshold, trigger a warning condition.

Additionally, you may want to consider implementing a dynamic adjustment mechanism for the advertisement interval (KADEMLIA_ANNOUNCE_INTERVAL). If the queue size exceeds a certain threshold, you can decrease the interval to increase the frequency of content broadcasts and alleviate the bottleneck. Conversely, if the queue size remains consistently low, you can increase the interval to optimize resource usage.

Remember to carefully analyze the impact of any adjustments to the advertisement interval to ensure it aligns with your specific requirements and network conditions.