bisq-network / bisq2

GNU Affero General Public License v3.0
161 stars 61 forks source link

Optimize Scheduler to use less threads #1793

Open HenrikJannsen opened 5 months ago

HenrikJannsen commented 5 months ago

The Scheduler creates a new ScheduledExecutorService each time it gets created. We should avoid creating new ScheduledExecutorServices each time. Using a pool does not work well as there is only one API with a fixed pool core pool size but it is hard to estimate the right number for that. We can use a cache where idle ScheduledExecutorService instances are retired and reused when a new Scheduler is created.

HenrikJannsen commented 5 months ago

Part of the problem with growing threads was caused by a bug in the InventoryRequestService, fixed in https://github.com/bisq-network/bisq2/pull/1799

HenrikJannsen commented 5 months ago

With v2.0.1 I could not observe growth of nr. of threads anymore. But we still should find a better solution for the Scheduler.