Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing NGINX log files is needlessly slow. #64

Open
Alextopher opened this issue Mar 6, 2024 · 0 comments
Open

Parsing NGINX log files is needlessly slow. #64

Alextopher opened this issue Mar 6, 2024 · 0 comments

Comments

@Alextopher
Copy link
Member

Alextopher commented Mar 6, 2024

Regular expressions considered harmful.

Mirror/nginx.go

Lines 119 to 120 in 046b562

// "$time_local" "$remote_addr" "$request" "$status" "$body_bytes_sent" "$request_length" "$http_user_agent";
quoteList := reQuotes.FindAllString(line, -1)

Splitting on the " characters is significantly more efficient, somewhere between 10x-100x so. This kind of performance improvement wouldn't be meaningless either. Somewhere between 500 MB and 1500 MB of data is passing through this parser daily.

This would make a good first issue 😉. You can easily compare the output of the previous version to a new version on gigabytes of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant