Introduce StreamParsingStrategy
to support builds with large logs
#40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implementation is currently opt-in by setting the system property
hudson.plugins.logparser.ParsingStrategy
tohudson.plugins.logparser.StreamParsingStrategy
on agents, but it'd be simpler to replace the current strategy.The new strategy relies on Java 8 features and improves throughput with less code. I'm happy to make that change, but thought it'd be worth discussing first.
📝 Description
We have a job using this plugin that intermittently hangs. I have been able to reproduce the scenario by creating a job that logs many lines, creating an
OutOfMemory
error on the agent. A new strategy is included here that allows the plugin to parse builds with more logs than the current approach.Parsing time is a function of the number of lines in the file and the number of rules. To test this, I defined one rule and ran it on a job that created a set number of lines. 10% of the lines matched the rule. I expect 100 rules run against 100 lines would scale similarly to 10 rules run on 1,000 lines or one rule on 10,000 lines.
StreamParsingStrategy
I'm using the already-existing log statement in
LogParserParser
to get this data. For small log files, both are under a second.💎 Type of change
🚦 How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
I extracted the current code into a
ClassicParsingStrategy
and introduced a newStreamParsingStrategy
. The new classes have unit tests that verify behavior.For testing large logs, I deployed Jenkins 2.361.2 on an Azure Standard D2s v3 (2 vcpus, 8 GiB memory) and an agent with one executor on another Standard D2s v3. I installed v2.3.0 from the update center to gather the baseline data. I built the plugin locally at this commit, uploaded, and set the system property for the comparison data.
I created a job that would log out 10 lines on a loop, and a rules file with one rule.
build script
🏁 Checklist: