Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/dbwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ static leveldb::Options GetOptions(size_t nCacheSize)
options.write_buffer_size = nCacheSize / 4; // up to two write buffers may be held in memory simultaneously
options.filter_policy = leveldb::NewBloomFilterPolicy(10);
options.compression = leveldb::kNoCompression;
options.max_open_files = 64;
// Scale the open-file cache with the configured DB cache so a large block
// index doesn't thrash file descriptors (matches Bitcoin Core's later
// scaling): 64 for small caches, up to 1000 for large ones. Each ~2MiB
// table is held open via these, so this is purely an I/O/FD tuning and
// does not change any stored or computed value.
options.max_open_files = 1000;
if (nCacheSize < 100 * 1048576) {
// Use the conservative default for small caches (e.g. unit tests,
// low-memory configs) to keep FD usage modest.
options.max_open_files = 64;
}
if (leveldb::kMajorVersion > 1 || (leveldb::kMajorVersion == 1 && leveldb::kMinorVersion >= 16)) {
// LevelDB versions before 1.16 consider short writes to be corruption. Only trigger error
// on corruption in later versions.
Expand Down
7 changes: 5 additions & 2 deletions src/httpserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
#include <boost/scoped_ptr.hpp>
#include <boost/function.hpp>

static const int DEFAULT_HTTP_THREADS=4;
static const int DEFAULT_HTTP_WORKQUEUE=16;
// Raised from 4/16 to avoid "Work queue depth exceeded" HTTP 500s under load
// (e.g. wallet/GUI bursts of concurrent RPC calls). Still user-overridable via
// -rpcthreads / -rpcworkqueue; config-only, no consensus or value impact.
static const int DEFAULT_HTTP_THREADS=8;
static const int DEFAULT_HTTP_WORKQUEUE=256;
static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;

struct evhttp_request;
Expand Down
Loading