Closed 317787106 closed 1 year ago
@317787106 Is the test data you provided a single result? What time period does it cover? If it is a single result, could you provide the average of multiple results from different time periods?
@317787106 Is the test data you provided a single result? What time period does it cover? If it is a single result, could you provide the average of multiple results from different time periods?
@chengtx01 what's the time period you mean? I don't have too many machines as resource limit, so I can only test it on several machines. These machines come from different time zone of the world.
resolve it in pr https://github.com/tronprotocol/libp2p/pull/55
Rationale
Background
The Libp2p module used in java-tron might start slowly in some network environments, sometimes as long as ten seconds. It is necessary to boost the startup speed to optimize the user experience.
Cause Analysis
Currently, libp2p obtains the internet IP(v4) by visiting the address http://checkip.amazonaws.com, and the internet IP(v6) through https://v6.ident.me. Users from different regions around the world access this two domain may be delayed for up to ten seconds or even cannot get access at all due to some reasons. Since the acquisition of IP is in the main thread, in some cases, the startup speed is slow.
Implementation
Design
Solution
Three domains are provided for IPv4: "http://checkip.amazonaws.com", "https://ifconfig.me/ ", "https://4.ipw.cn/", and two domains are provided for IPv6: "https://v6.ident.me", "http://6.ipw.cn/". Then, use ExecutorCompletionService to get the result. Therefore the burden of IP acquisition is shared and faster service is offered.
The core logic is as follows:
Testing
Time to obtain IPv4 and IPv6 addresses: