Skip to content
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

Parallelize API calls on the frontend #1271

Closed
nichhk opened this issue Jul 7, 2022 · 0 comments · Fixed by #1280
Closed

Parallelize API calls on the frontend #1271

nichhk opened this issue Jul 7, 2022 · 0 comments · Fixed by #1280
Assignees
Labels
Complexity: Missing This ticket needs a complexity (good first issue, small, medium, or large) Feature: Missing Milestone: Missing Role: Missing size: Missing

Comments

@nichhk
Copy link
Member

nichhk commented Jul 7, 2022

When the frontend gets 311 request data from the sever, it breaks the request up into multiple calls, each getting 5000 items currently. By default, the frontend displays data for the past week, which is typically 25-30k 311 requests, meaning that we are making 5 API calls sequentially. This takes around 5-10 seconds for me, running on a local frontend. We can parallelize these calls to make the request data load faster.

See the current implementation here.

To parallelize the calls, we have a couple options.

  1. Make each call get the data for a single day. This is nice because we don't need to know the number of total requests before hand. The downside is that if a single day has a lot more requests than the other days, it can slow the whole thing down.
  2. Make each call get a fixed number of requests. The downside is that it requires us to know the total requests for our date range so that we can make the appropriate number of calls. This would require us to implement a new API to get this info. The upside is that each request will be retrieving the same number of requests, theoretically smoothing out each call's execution time.

I'm leaning towards #1 right now since it's simpler, and in most cases, I don't think any given day will have significantly more requests such that it's obviating parallelization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Missing This ticket needs a complexity (good first issue, small, medium, or large) Feature: Missing Milestone: Missing Role: Missing size: Missing
Projects
Development

Successfully merging a pull request may close this issue.

4 participants