-
Notifications
You must be signed in to change notification settings - Fork 52
Use concurrency :shared and sync codecs to optimize performance
#46
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
Conversation
lib/logstash/outputs/file.rb
Outdated
|
|
||
| private | ||
| def write_event(event, data) | ||
| def write_event(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be renamed
|
my first results: With logstash 5.0.0-alpha6: Logstash master + logstash-output-file w/ this PR: I've tried this again:
|
|
Another error which |
|
@jsvd the error your reporting is strange to say the least, the first part of the message originate from the file output but the remaining part are from puma. |
|
@ph I just wanted to post the whole error stack, but the puma one is happening frequently on logstash exit, I'm going to open an issue |
|
@jsvd I am gonna take a look, we rewrote the puma integration not too long ago, I think we might be missing a rescue on close. |
|
I created an issue for the puma errors in elastic/logstash#5822 |
6ab2a13 to
eece460
Compare
| describe "ship lots of events to a file gzipped" do | ||
| Stud::Temporary.file('logstash-spec-output-file') do |tmp_file| | ||
| event_count = 10000 + rand(500) | ||
| event_count = 100000 + rand(500) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did catch some locking bugs here by upping this count to be a longer test.
|
@jsvd I've fixed all the issues here as well as made the locking a bit more coarse. I was also able to simplify the code around a simple |
concurrency :shared and sync codecs to optimize performanceconcurrency :shared and sync codecs to optimize performance
eece460 to
6c96b1d
Compare
As part of this refactor the `message_format` option had to be (finally)
obsoleted.It was previously deprecated for quite some time.
This provides a nice boost:
Before:
```
time bin/logstash -e "input { generator { count => 3000000} } filter { } output { file { path => '/tmp/newfileout'} }"
Settings: Default pipeline workers: 8
Pipeline main started
Pipeline main has been shutdown
stopping pipeline {:id=>"main"}
139.95 real 223.61 user 28.93 sys
```
After
```
rm /tmp/newfileout; time bin/logstash -e "input { generator { count => 3000000} } filter { } output { file { codec => json_lines path => '/tmp/newfileout'} }" ; ls -lh /tmp/newfileout
Settings: Default pipeline workers: 8
Pipeline main started
Pipeline main has been shutdown
stopping pipeline {:id=>"main"}
56.12 real 192.99 user 17.38 sys
```
6c96b1d to
ee244b7
Compare
|
@jsvd I've bumped the plugin API so it will require LS 5.0+ to properly handle the obsolescence. |
|
Tests pass, manual tests also good, nice work |
|
Thanks @jsvd ! |
|
Andrew Cholakian merged this into the following branches!
|
This is a WIP. This commit has added locking, but I may have missed some locks in a few spots, so it needs another pass before its really ready.
This provides a nice boost:
Before:
After