Chih-Chieh, you have wondered correctly. Browsers have connection limits against particular servers which affect AJAX requests. One web development oriented solution to avoid this is by using multiple (sub)domains that point to the same machine - this allows you to surpass the limit, based on the cardinality of dimensions used. The problem is the complexity that arises. It's one factor that made CDNs quite popular.
To solve this may require work more on Grafana's end than Prometheus'. Here are some ideas I see:
* Introduce batch queries to Prometheus and alter Grafana to use them. Grafana supports other datasources and how this would work with them deserves to be considered. As Brian mentioned is the complexity worth introducing?
* Grafana could be modified to try and stream queries in the background, perhaps ahead of time. This is more complexity and even likely wastes bandwidth with prediction misses but could potentially give you better UX when looking at those charts.
* Grafana could store last retrieved results in local storage and utilize that data while the query is running. This is simplest approach to reduce time spent looking at grafana panels with progress indicators spinning.
* Users could expose Prometheus through multiple endpoints and have Grafana round-robin through them or use them randomly. This would be the best - Grafana needs to handle multiple server configs, but already has precedent with CSVs doing something similar in many areas of it. Otherwise it pushes all onus on the end user. e.g. Now instead of "
prometheus.com" datasource endpoint, we feed Grafana
a.prometheus.com,
b.prometheus.com" endpoint. If A records point to the same prometheus the queries should still execute properly but all in parallel, giving you the quick response you desire with no change to Prometheus.
I think the fourth is best but not sure how to advise in a way that will work for all cases - I imagine domains and how people are scraping is quite different between users.