Sling Sitemap supports background generation (using Sling Jobs) and on-demand generation.
The later is useful for small sites/small sitemaps that can be served on-demand in a reasonable amount of time (e.g. traversing only a small subtree of a site). For any other use case the former one is meant to be used.
For applications that use a Sling cluster for content staging and a farm of replicas for delivery of published content, the background generation would be configured on the staging tier and the generated sitemaps would be distributed to the delivery tier, in order to prevent computation on all of the replicas of the delivery farm. However when including actual content in the sitemaps (image/video/news) the content of the staging environment may be different from the delivery farm and so the sitemap not accurate.
In such an environment it makes sense to run the job to generate the sitemaps outside of Sling actually (may be on anther Sling instance however or anything else). For that the sitemap generation process should be made available through a paginateable/streamable API that can be accessed via HTTP.
A good starting point would be Sling GraphQL Core's pagination feature.