In the process of continuous iterative development of microservices, due to the continuous addition of new features, some old features are continually being modified, and interface compatibility issues face enormous challenges, especially in the running environment multi-version coexistence (grayscale release) ). This chapter mainly describes some practical suggestions for interface compatibility management and solutions to compatibility problems during use. Since microservices generally provide services externally through the REST interface, the interface here refers to the REST interface without special instructions.
To prevent interface compatibility problems, developers are advised to follow the following principles when making interface changes (add, modify, delete, etc.).
ServiceComb also has the following considerations:
During the development phase, due to various interface modification, the data of the service center would not be cleaned up, and the interface call fails when debugging. Developers are advised to install and download a [frontend] of the service center (http://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-service-center/1.0.0-m1/), anytime Clean up service center data.
If you use Huawei's public cloud online service center, you can log in directly using the management functions provided by the microservice engine to delete.
During the release phase, you need to review the steps of the interface-compatible practices to ensure that interface compatibility issues are not online.
If you accidentally miss one of these steps, it may lead to the following interface compatibility issues:
Workarounds for problems: There are different interface compatibility issues and different handling methods. In extreme cases, you only need to clean up the Provider and Consumer microservices, and then restart the microservice. When the service call relationship is complexed, the interface compatibility problem will be more extensive and clean the Provider, and Consumer data will become complicated. Therefore, it is recommended to follow the above specifications to avoid incompatibility.
It may be that the Provider has added an interface, but there is no update version number. You need to delete the microservice data or update the version number, restart the Provider, and restart the Consumer.