Slow startup with too many networks
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Haguichi |
Fix Released
|
Medium
|
Stephen Brandt |
Bug Description
- With more than 70 networks with 20 machines each , Haguichi takes a long time to start and to refresh networks (F5).
- I've tested with the following hardware:
- AMD Fx-8120 3.1GHz (8-cores) with 8GB RAM: about 7 seconds to start.
- AMD Phenon 2 X4 3.0 GHz with 8GB RAM: about 35 seconds to start.
- Intel Core2 Quad (4-cores) with 8GB RAM: about 30 seconds to start.
- AMD Phenon 2 X2 with 8GB RAM: about 1 minute to start.
- During the startup time, the whole machine becomes incredibly slow, and we had to disable the 'Update the network list every X seconds' feature to make it usable after it started.
- Tinkering with the sources, I've found that class Member starts a new Thread in method 'GetLongNick' every time it founds a name longer than 25 characters to call a "hamachi peer" and get the full name.
- It also may start a new thread calling "hamachi peer" when it needs to get the addressess in method 'GetCompleteAdd
- When many threads try to call the "hamachi" client, it is bound to return some "busy" messages, and Haguichi keeps on trying until it gets an actual response, making the situation even worse.
- Proposed solution:
- Create some kind of 'Event Dispatch Queue/Thread' that processes these events in a single separate thread, instead of creating so many threads.
- Because the "hamachi" client seems to be single-thread also, I don't think it will actually take longer to fetch all the long names.
Changed in haguichi: | |
status: | Fix Committed → Fix Released |
- Just tried commenting out the lines that start a new Thread in Member.cs, and the results were great!
- On the AMD Phenon 2 X4, it took only 3 seconds to start (instead of 35)