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

Reduce write timeouts #7942

Merged
merged 6 commits into from
Feb 10, 2017
Merged

Reduce write timeouts #7942

merged 6 commits into from
Feb 10, 2017

Conversation

jwilder
Copy link
Contributor

@jwilder jwilder commented Feb 3, 2017

This PR has a few changes to reduce write timeouts which can cause 500s via the HTTP API.

  • The number of cache partitions is increased from 256 to 4096 which reduces the lock contention in partition.write.
  • If enough compactions goroutine are running concurrently, they may tie up a CPU core for long periods of time and not allow the go runtime to schedule other goroutines. runtime.Gosched() was added in a few spots during compactions where this could occur to allow write goroutines to continue.
  • FileStore locks were modified to reduce contention while the Engine is locked.

When replacing TSM files, the new files can be opened before
the write lock is taken to reduce lock contention in this code
path.
@jwilder jwilder added this to the 1.3.0 milestone Feb 3, 2017
@jwilder jwilder requested a review from e-dard February 3, 2017 20:40
@sebito91
Copy link
Contributor

sebito91 commented Feb 3, 2017

Using this patch in Production at the moment, significant performance improvement (reducing 500s to virtually nil during high read + write volumes).

Every write to the WAL current runs and fsync before returning.  When
there are lot of concurrent writes, this can cause the WAL to bottleneck
write throughput since fsyncs are very expensive.

This changes the writeToLog to fsync on an interval to allow multiple fsyncs
calls to be batched up into one.  The writeToLog behavior is the same in that
it won't return until an fsync has been performed.
@jwilder jwilder merged commit 4b6289c into master Feb 10, 2017
@jwilder jwilder deleted the jw-cache-partitions branch February 10, 2017 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants