Skip to content

Optimize couch server#2277

Merged
davisp merged 6 commits intomasterfrom
optimize-couch-server
Jan 5, 2020
Merged

Optimize couch server#2277
davisp merged 6 commits intomasterfrom
optimize-couch-server

Conversation

@davisp
Copy link
Member

@davisp davisp commented Oct 24, 2019

Overview

This makes couch_server able to handle quite a bit more load.

Testing recommendations

make check

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation

@davisp
Copy link
Member Author

davisp commented Oct 24, 2019

I'd recommend to any reviewers to at least go through the PR commit by commit first as each change is relatively logically independent.

@davisp davisp force-pushed the optimize-couch-server branch 3 times, most recently from fa3a2e9 to 879ebf3 Compare January 4, 2020 21:50
@janl janl added this to the 3.0.0 milestone Jan 5, 2020
davisp added 6 commits January 5, 2020 13:21
Previous this test relied on delete/open requests getting things into a
confused state. Now that we understand the issue we can replace the more
complicated logic by directly polutnig couch_server's message queue with
invalid messages.
Its not uncommon to have file_server_2 behaving poorly so we'll avoid it
when there are calls that are made often.
Even when disabled these logs can take a non-trivial amount of
reductions which can add extra suspensions to couch_server's main loop.
We can track the open latencies from the async_open process so that
couch_server does not have to perform the update in its main loop.
This moves the database name check and engine lookup into the open_async
process. There's no reason that this work had to happen in the main loop
so we can easily move the regex and engine lookups out of the loop to
minimize the work per handle_call even further.
In a VM with lots of processes couch_server can end up slowing down
purely to not being scheduled which in turn will cause its message queue
to backup. We've attempted this before but due to message passing have
never seen it have a significant effect. However, now that we're
actively avoiding synchronous message passing inside the man loop this
has a significant effect by being able to process messages as soon as it
has one in its mailbox.
@davisp davisp force-pushed the optimize-couch-server branch from 879ebf3 to bd351da Compare January 5, 2020 19:29
Copy link
Contributor

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@davisp davisp merged commit a595401 into master Jan 5, 2020
@davisp davisp deleted the optimize-couch-server branch January 5, 2020 20:16
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

Successfully merging this pull request may close these issues.

3 participants