NIFI-14837 - Performance improvement GitHub Registry Client - #10186
Conversation
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for proposing this improvement @pvillard31, adding caching and limiting commits retrieved from GitHub are helpful improvements.
I am concerned about adding the Cache Directory property, because it introduces potential compatibility concerns on future upgrades. Although the cache format may not change very often, it introduces an additional layer of compatibility concern down the road. It seems better to restrict caching to something memory-based.
As far as maximum commits, having a limit seems reasonable, but I'm also not sure if this needs to be a configurable property. Setting a reasonable maximum seems like a safety feature to avoid unnecessary consumption, and going beyond a certain limit seems unnecessary and potentially unusable in the context of reviewing changes. Perhaps setting an internal limit of 1000 is the best approach for now?
|
Thanks @exceptionfactory
I did think about adding a custom in-memory cache via an OkHttp interceptor but I'm concerned about the size in case the flows that we retrieve are particularly huge. Unless I limit the interceptor to very specific endpoints being called like list commits, get commit details. But it felt overcomplicated. To be honest the most significant improvements are the commits caching and limiting the number of commits being retrieved so I'm also OK dropping the OkHttp caching for now.
I did think about it and I don't have a strong opinion. Something that I did consider is to add a property "Enable Caching" true/false that would make visible all of the new properties (including the one about how many commits are retrieved?) and expose this "magic number" that is currently set to 1000. No strong opinion tbh. |
|
Thanks for the reply @pvillard31. If the most valuable improvement comes from limiting the number of commits returned, I would be in a favor of introducing a hard-coded default limit. If that proves to be too restrictive for some reason, revisiting this an introducing a configurable property could be a follow on effort. |
|
Just to make sure we're on the same page:
And remove the okhttp client cache that is file based. Right? |
Slight adjustment to the first bullet, I recommend a hard limit on the number of commits retrieved, as I don't think it needs to be a configurable property. Yes, on the in-memory cache with hard-coded limit, and yes on the removing the OkHttp client cache. |
That would prevent someone from being able to see the full list of versions for a given flow. While this is probably not necessary in 99% of the scenarios, hard coding the value would definitely prevent someone from seeing the full history. Are we OK with this? |
Yes, that's where I think at some point, the number of versions would be effectively unusable. So a large, but limited, number seems like a good approach. |
|
Sounds good, thanks @exceptionfactory, I have made the corresponding changes |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @pvillard31, just one more question related to commit size retrieval.
| if (i >= MAX_COMMITS_TO_RETRIEVE) { | ||
| break; | ||
| } |
There was a problem hiding this comment.
Limiting this after retrieval does not seem like the best approach. The Page Size appears to limit the current number to 50. Would it be sufficient to switch that to 10?
There was a problem hiding this comment.
The page size does not limit how many commits we retrieve, only how many commits we have per page but the listing would go over all of the pages regardless. This is something in the implementation of the client itself. The only way to limit the amount of commits retrieved during listing would be by providing an "afterDate" value in the query builder.
There was a problem hiding this comment.
Made a small change to use the client in order to only retrieve the first page of commits and only define a page size.
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks @pvillard31, the updated approach looks good. +1 merging
Summary
NIFI-14837 - Performance improvement GitHub Registry Client
I'm using the GitHub Registry Client in my NiFi instance. I have about 50 process groups that are versioned. Every process group matches a versioned flow that may have tens of commits.
When I want to change version, the current implementation will list all commits, and for each commit, will make an API call to GiHub in order to retrieve some specific informations (commit message, commit date, etc).
This is extremely ineffective and changing the version a flow ends up taking a very long time. For some cases with many commits, I cannot change version because the call in the NiFi UI would time out before the backend has sent back the full list of commits with all of the information.
This becomes very not friendly and barely usable. This will also impact the API rate limits a lot.
This change is to introduce multiple improvements that are making all of this MUCH better.
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation