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

Limit concurrency of zonal statistics jobs #228

Closed
2 tasks done
j08lue opened this issue Sep 21, 2023 · 5 comments
Closed
2 tasks done

Limit concurrency of zonal statistics jobs #228

j08lue opened this issue Sep 21, 2023 · 5 comments
Assignees

Comments

@j08lue
Copy link

j08lue commented Sep 21, 2023

Currently, if a single user requests zonal statistics for 3 years worth of daily data, that will fire off more than 1000 Lambda executions at the exact same time. 1000 is the default global account limit of concurrent requests. We can easily increase that (we just requested 10k, just in case), but such a massive concurrent execution is probably not a good idea.

We need to address this programmatically - even when a user sends off a request like this, it should get rejected (gracefully) by the API. Maybe we can also reduce concurrency in the backend by limiting the number of "workers" that handle the per-file extraction jobs?

As @amarouane-ABDELHAK pointed out, another guardrail to put on could be to limit the number of concurrent Lambda executions for the worker Lambda, if that is possible. That way, executions of this particular function will not be able to exhaust the global account limit.

Acceptance criteria

  • Created tickets in relevant projects to address this challenge and linked them here
  • Limited concurrency in one and/or another way
@j08lue
Copy link
Author

j08lue commented Sep 21, 2023

Already discussed a bit with @vincentsarago here NASA-IMPACT/veda-ui#660 (comment)

@amarouane-ABDELHAK
Copy link

I’m still examining the concurrent Lambda executions, and it appears that we should be in good shape. The rasterapi Lambda function processing duration is super short (10 ms when it is warm).
I even attempted to submit 26,000 requests in parallel, but it seems that only 100 concurrent executions were triggered ( I believe this behavior is probably because of Lambda’s automatic queuing mechanism).
image (1)
image

@vincentsarago
Copy link
Contributor

@j08lue looking back at this I think I misunderstood the original issue. This is not related to titiler-pgstac but more a frontend (allowing the user such a big interval) / backend configuration (number of concurrent lambda as pointed but @amarouane-ABDELHAK) issue.

@j08lue
Copy link
Author

j08lue commented Sep 25, 2023

Ah, I just realized that it is the client (frontend) that issues all the parallel requests. I had assumed that the frontend made a single request and then the backend would calculate and spawn all the processing jobs.

image

Yes, in that case, it is just a matter of limiting what users do in the UI.

Plus safeguarding that concurrency limit in AWS, if possible.

@j08lue
Copy link
Author

j08lue commented Oct 6, 2023

Limits implemented in FE.

@j08lue j08lue closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants