AdrKacz / super-duper-guacamole

Awa is a mobile application to make new friends 🔥
https://awa-chat.me
Other
5 stars 1 forks source link

📈 Scan Group table in Parallel to reduce function time in Schedule Check Users #423

Open AdrKacz opened 1 year ago

AdrKacz commented 1 year ago

Is your feature request related to a problem? Please describe

Scan is sequential: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/scancommand.html

Scan operations proceed sequentially; however, for faster performance on a large table or secondary index, applications can request a parallel Scan operation by providing the Segment and TotalSegments parameters. For more information, see [Parallel Scan](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan) in the Amazon DynamoDB Developer Guide.

Check if there is an opportunity here.

What will happen if the User Table grows and the function take more than three minutes to complete? It will timeout ... we should be able to detect that, or at least we should monitor the time to complete the scan to act when it starts to reach the limit.

AdrKacz commented 1 year ago

Un problème un peu plus important: la fonction n'exécute en séquence, donc un group par un group, puis un utilisateur par un utilisateur. On pourrait tout faire en parallèle.