LogAn Performance Optimization#16
Open
rh-rahulshetty wants to merge 3 commits intoLog-Analyzer:mainfrom
Open
Conversation
Signed-off-by: Rahul Shetty <rashetty@redhat.com>
Signed-off-by: Rahul Shetty <rashetty@redhat.com>
Signed-off-by: Rahul Shetty <rashetty@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reduces end-to-end LogAn processing time by ~57% (413s → 178s) through targeted optimizations across preprocessing, template mining, diagnosis backtracking, and anomaly grouping — with no changes to output behavior.
Key Changes
Preprocessing (
preprocessing.py)ThreadPoolExecutor, and collect file stats (size, line count) during the initial read to eliminate a redundant second pass incompute_preprocessing_statistics.datetime.strptime()first (~5–10x faster thandateutil.parse), falling back to dateutil only as a last resort.isalpha()/isdigit()with precompiled regexsub()+len().pd.Seriesconstruction —parallel_applynow returns plain tuples; a singleDataFrameis built from the collected list, avoiding the overhead of constructing apd.Seriesper row.parallel_applyrow-by-row truncation withnp.where+str[:upper_bound].lstrip()[0] == '{'prefix check avoids callingjson.loads()on non-JSON lines.min(..., 4)cap) and disable progress bar to reduce synchronization overhead.Diagnosis backtracking (
core.py)progress_applyrow-by-row backpropagation with a list-comprehension lookup + direct column assignment.np.wherefor error_test_ids — Replace row-levelapply(lambda)with a vectorizednp.whereconditional.Anomaly grouping (
anomaly.py)Template mining (
run_drain.py)df.apply(lambda, axis=1)with a loop over.values, avoiding per-rowpd.Seriesconstruction.Performance
Benchmarked on the same log corpus with identical hardware.