Service Mapping — How to handle dynamic ports for microservices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi ServiceNow Community,
We’re building Service Maps for several applications. In some cases, the infrastructure includes microservices servers that do not have a clear entry point to discover/map from.
To include these servers in the service map, we are currently using the running service port on the server along with the API path/name—for example:<ServerName>:<port>/api/<name>
Issue: The service port is dynamic and changes after each service restart, so we have to update the port frequently to keep the service map accurate.
Has anyone dealt with this scenario before? If so, what is the recommended way to handle dynamic ports in Service Mapping so we don’t need to manually update ports after restarts?
Thanks in advance.
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey,
In those cases, could you have the process of the micro service as an entry point instead? This would allow you to ignore the HTTPS entry point and just jump the service directly.
Essentially how ServiceMapping works is pretty straight forward. The information around entry points is stored in entry point CIs (cmdb_ci_endpoint). An endpoint has then a relationship to an application record. This is where we get the relationship from.
When mapping top-down, ServiceMapping will first identify the host, based on the connection parameters. Then it will discover the host and the applications running on the hosts. Lastly, any endpoints for the applications on the host are then filtered to see if there is one that matches your definition (which is also why sometimes your host appears in the map, but the application you are looking for is highlighted as missing).
So for microservices we need to have the host information (e.g. the IP address under which that host is reachable) and then whatever we can use to uniquely identify the actual application we want to discover. In most cases this will be the api-port connection (as this can be extracted from the TCP-to-TCP connection from any app connecting to your application). So for any microservice which we discover within a given, larger service map this actually is fine (because the TCP-to-TCP connection is actually live).
If you want to go directly through that microservice you "just" need to make sure to define an endpoint which is indeed unique enough to only link to your app. With APIs, it depends on your architecture (best case you actually have a loadbalancing service before the micorservice which then again has a static address. If so, use that one).
In the end, nothing is preventing you from just setting the entry point of the micorservice map to be the service directly. Having the TCP endpoint in there is just what's normally used (also used in top-down discoveries where you service is part of). So it is present anyways.
In your case it's just that you want to start directly with the microservice and you don't have a hard definition for it. So take whatever you have as a static definition. And if that is the running service (e.g. identified through the install path or running command), just use that.
Please let me know if this helps.
Regards
Fabian
