-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark Dashboard code and discuss/document possible performance improvements #1340
Comments
As suggested in here - NREL/api-umbrella#140 (comment), there is a way to fetch analytics using API-Umbrella's REST API and it's more secure. Analytics drilldown data should be accessible via this URL: |
Basic benchmarkAs an example, here are some measurements of the data fetching step with 25,000, 50,000, and 60,000 records: Time for data fetching, as might be expected, seems to increase proportional to the number of records requested. The above chart lacks values for the overall page load, which would give us a better idea of the proportion of page load time spent fetching data. A basic estimate would be that 30-50% of page load time is spent waiting for data, with the remainder in other tasks such as parsing and painting (more benchmarking is needed). MethodThe above chart was generated by reloading the dashboard 10 times and with each of the request values:
This test can be reproduced by checking out the feature/dashboard-chart-benchmark branch. The requested records value can be changed by editing dashboard/client/dashboard.js:61 |
As discussed earlier if using aggredated data which is provided by API Umbrella via REST API this cuts the need in performance improvements since the chart with data loads instantly within any data ranges. NREL/api-umbrella#275. This is partly implemented in https://github.com/frenchbread/apinf-dashboard-example. Also if fetching data directly from API-Umbrella REST interface, it solves the security issue for elasticsearch being publicly accessible (any data can be fetched from there now with no Auth). So elastic search instance should be hidden from public access and accessible only by api umbrella instance though its own private network on a server. |
@frenchbread is the ES interface open by default? Would be better to close it up in the default installation... |
@philippeluickx yes, it is.
I'm not sure how elastic search works within API umbrella but closing both & routing them though apinf would work well. (Api umbrella requires API key & token so hiding ES may be enough but not sure if it's possible) |
We should make sure ES interface is closed by default... |
Based on the above benchmark, it takes around five seconds to fetch 50,000 records to the server from Elastic. This means that any server aggregation function would have to wait for Elastic data to load, and that wait time can quickly exceed the five second target 'dashboard render time'. We can probably pre-fetch the analytics data, as has been tried in a previous experiment, and store it, for example, in our MongoDB. Another approach might be to ask Elastic to return aggregated data. I am also aware of @frenchbread's experiment with the API Umbrella Drilldown Analytics endpoint. If we use the API Umbrella drilldown analytics, what chart(s) could our dashboard contain (e.g. could we include response codes or response time aggregation charts - #s 2 and 3 above)? |
@frenchbread , when passing the interval, do the results contain fields such as 'response time' and 'response code'? For reference in this discussion, the API Umbrella analytics REST API allows us to pass in several arguments:
References
|
Results only contain grouped timestamps and host/ipaddr values where request came from. Another approach would be filtering by |
The second approach, filtering by status code and then aggregating on the server, might still leave us with slow chart loading times. E.g. there could easily be a scenario where a server has 50,000+ requests that have 2xx status codes, which would take >5 seconds to transfer to Apinf for the aggregation step. Lets try to rely directly on Elasticsearch to perform the aggregations by structuring the API Umbrella analytics query with multiple Elasticsearch filter/aggregation parameters. |
Current Dashboard performance is slow - loading is capped at 50K records and this query take 10s. There can be several places where Dashboard performance could be improved, so care should be taken before proceeding with any single solution.
Objective
Before going with further experiments, it is good to have a baseline measure of performance for comparison.
We should try to measure the overall time, on average, that the dashboard takes to render as well as time spent on each stage. This will give us better insight on strategies for optimization.
Rendering stages
There are a few stages involved in rendering the dashboard charts, including:
Each stage in the rendering sequence adds some amount of delay to the overall user experience.
Proposed changes:
Next steps:
Definition of done
The text was updated successfully, but these errors were encountered: