The synchronization of AP nodes is realized by means of asynchronous task + message queue.
After the task is taken out, it will be put into a List collection.
Then you will find that the execution of the task is conditional.
First of all, the number of nodes in the current cluster is equal to 1000, then the synchronization will start directly at this time. Of course, this condition will not be true in small projects, so there is another condition that the current time and the last synchronization time exceed 2s. A task synchronization will be performed.
When performing data synchronization here, we can consider that the registered node this time may be registered to Nacos server 1, then several other Nacos servers want to synchronize instance data to their own memory, we can use many Simple HTTP way to synchronize data.
It can be found that in the end, it is actually a method of sending HTTP requests and then sending service instance synchronization.
Then call back the method of data synchronization.