Running our spring boot application takes 2-3 minutes to boot. Bulk of the time was spent on connecting to different servers via Spring Cloud Consul Discovery Client.
I'm looking for a way to cache service discovery in a separate application like in the following diagram:
+----------------------+ +----------------------+
| | | |
| Target Server | | Consul Server |
| | | |
+-----------^----------+ +-----------^----------+
|(3) |(2)
| |
+----------------------+ +----------------------+
| |(1) | |
| Application |---> | Consul Client Cache |
| | | |
+----------------------+ +----------------------+
- Application queries consul client cache instead consul server directly to retrieve the network address of the target server.
- Consul Client Cache is a standalone application where it loads and caches the IP addresses of the services registered in consul server.
- Application connects to target server.
At the top of my mind, I believe this is possible by:
- Writing a spring boot application of consul client cache wherein it caches the services registered in consul server and serves them to the application upon request.
- Intercept the HTTP requests of application and re-route to consul client cache server.
But this seems a generic problem so I'm hoping there is already a ready-made solution out there.
Anyone has ideas?