The previous analysis of Websocket synchronization, ZooKeeper synchronization and HTTP long polling synchronization, this paper hopes to compare these three data synchronization strategies from several dimensions such as availability, effective time and performance, so as to provide a reference for the actual selection of the project.

The principle of review

  • Websocket synchronization is when soul-admin has a data change, the change data is pushed to soul-Bootstrap. The soul-Bootstrap WebSocketClient updates and changes the configuration. Websocket synchronization is the default data synchronization strategy;

  • Zookeeper synchronization is when the soul-admin starts, the configuration data is written to the ZK nodes. The soul-Bootstrap gateway cluster listens to these ZK nodes and updates the configuration when the nodes change.

  • HTTP long-poll synchronization is when the soul-bootstrap side continuously sends HTTP requests to the soul-admin side to check whether any data has been changed. If any data has been changed, the soul-bootstrap side will immediately return the data. Otherwise, the soul-bootstrap side will wait for a period of time for asynchronous return. Note that if configuration changes are found, you need to send a request to pull configuration content again.

To compare

Data Synchronization mode Push-pull mode Effect of time Impact on application performance Ease of use Order of magnitude
Websocket synchronization push Immediate effect general simple A lightweight
They are synchronous push Immediate effect general Rely on ZK middleware A little heavy
HTTP long poll synchronization pull Delay time big simple A lightweight

Note: This is only an intuitive comparison, without the basis of performance pressure measurement, so the conclusion may not be precise.

conclusion

  • The soul gateway data synchronization policy is essentially how to select a configuration center.

  • For example, if a forwarding rule is changed, it must take effect immediately. Otherwise, back-end service systems may be affected. So websocket synchronization and ZooKeeper synchronization might be considered here;

  • If an application access configuration center needs to maintain a ZooKeeper cluster, the maintenance cost of its own system increases, and the availability of the cluster is difficult to ensure. Therefore, using the ZooKeeper synchronization strategy may not be lightweight enough.

series

  • Soul source learning [1] – preliminary exploration
  • Soul source learning [2] – divide load balancing plug-in
  • Soul source learning [3] – Dubbo plug-in
  • Soul source learning [4] – RateLimiter stream limiting plug-in
  • Soul source learning [5] – SpringCloud plug-in
  • Soul source learning [6] – Chain of responsibility mode
  • Soul source learning [7] – Data synchronization strategy websocket synchronization
  • [8] – Data synchronization strategy for ZooKeeper synchronization
  • [9] – ZooKeeper Synchronization (2)
  • Soul source learning [10] – Observer mode application
  • Soul source learning [11] – Data synchronization strategy HTTP long poll synchronization
  • Soul source learning [12] – Data Synchronization strategy HTTP long Poll synchronization (2)