umustafi opened a new pull request, #3640: URL: https://github.com/apache/gobblin/pull/3640
Dear Gobblin maintainers, Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below! ### JIRA - [X] My PR addresses the following [Gobblin JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR" - https://issues.apache.org/jira/browse/GOBBLIN-1783 ### Description - [X] Here are some details about my PR, including screenshots (if applicable): We seek to improve initialization time of the `GobblinServiceJobScheduler` upon restart or new leadership change by batching the mysql queries to get flow specs. Instead of making 1 mysql get call for each flow execution id, which scales extremely poorly with number of flows, we should group them to reduce number of calls and downtime. This implementation adds two new functions to the `SpecStore` interface, `getSortedSpecURIs` and `getBatchedSpecs`, that we use to achieve the batching. Because these two functionalities are generic enough to be used in derived classes of the `SpecStore` we add them to the base class. Although this requires any child classes to implement these functions, it allows any consumer of the parent class `SpecStore` to use this functionality without caring about the specific implementation of the `SpecStore` used (as `GobblinServiceJobScheduler` does). Additionally, the `getBatchedSpecs` requires an `offset` or starting point to obtain the batches from so the consumer has to do some book keeping of where in the paginated gets we are but this again separates the functionality from the use case of the consumer. the entirety of the flow catalog is too large to load into memory for the `GobblinServiceJobScheduler`, so we use this batch functionality. ### Tests - [X] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason: The main testing for this functionality will be empirical testing to determine the batch size which results in decreasing the time needed for all the gets above. In general, the time should go down with a larger batch size but there may be an inflection point where we see diminishing returns or the memory required to store a large batch is excessive. I propose testing with batch size 100, 250, and 750 incrementally and using the time metrics emitted to settle on an appropriate size. ### Commits - [X] My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)": 1. Subject is separated from body by a blank line 2. Subject is limited to 50 characters 3. Subject does not end with a period 4. Subject uses the imperative mood ("add", not "adding") 5. Body wraps at 72 characters 6. Body explains "what" and "why", not "how" -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
