-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
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_++; | ||
} |
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 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_); |
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.
std::unique_lock<std::mutex> lock(readLock_); | |
std::unique_lock<std::mutex> lock(readLock_); | |
if (isStopping()) | |
continue; |
No description provided.