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

Address performance issues reported with 1.9.0 #4152

Closed
wants to merge 2 commits into from
Closed

Address performance issues reported with 1.9.0 #4152

wants to merge 2 commits into from

Conversation

nbougalis
Copy link
Contributor

No description provided.

This commit addresses minor bugs introduced with commit
6faaa91:

- The number of threads used by the database engine was
  incorrectly clamped to the lower possible value, such
  that the database was effectively operating in single
  threaded mode.

- The number of requests to extract at once was so high
  that it could result in increased latency. The bundle
  size is now limited to 4 and can be adjusted by a new
  configuration option `rq_bundle` in the `[node_db]`
  stanza. This is an advanced tunable and adjusting it
  should not be needed.
Several hard-coded parameters control the behavior of the ledger
acquisition engine. The values of many of these parameters where
set by intuition and have complex and non-intuitive interactions
with each other and other parts of the code.

An earlier commit attempted to adjust several of these parameters
to improve syncing performance; initial testing was promising but
a number of operators reported experiencing syncing and stability
issues with their servers. As a result, this commit reverts parts
of commit 1823506.

This commit further adjusts some tunables so as to increase the
aggressiveness of the ledger acquisition engine.
readCondVar_.wait(lock);
runningThreads_++;
}
Copy link
Contributor

@greg7mdp greg7mdp May 2, 2022

Choose a reason for hiding this comment

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

I think I see a potential deadlock. Suppose one of the threads is interrupted right after checking while (!isStopping()) at Database.cpp:71 and then another thread calls Database::stop(), sets readStopping_ to true, takes the lock and calls readCondVar_.notify_all();.

When the thread resumes, it will wait forever on readCondVar_.wait(lock), I think?

This could be addressed by checking isStopping() right after taking the lock (see next suggestion).

@@ -68,14 +74,20 @@ Database::Database(
std::unique_lock<std::mutex> lock(readLock_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::unique_lock<std::mutex> lock(readLock_);
std::unique_lock<std::mutex> lock(readLock_);
if (isStopping())
continue;

This was referenced May 10, 2022
greg7mdp referenced this pull request in seelabs/rippled Jul 18, 2022
@nbougalis nbougalis deleted the 190fixes branch October 16, 2023 06:00
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