diff options
author | Howard Chu <hyc@symas.com> | 2017-10-30 18:06:32 +0000 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2017-11-02 16:33:48 +0000 |
commit | 7c7d36725ae184f2357d2296397c905ca486dbca (patch) | |
tree | 59c6f19ef956b69a978383767200e998f9ded11b /src | |
parent | Use max_concurrency as-is (diff) | |
download | monero-7c7d36725ae184f2357d2296397c905ca486dbca.tar.xz |
Increase LMDB maxreaders if large number of threads in use
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 3979a5edf..c44f7ad25 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -34,6 +34,7 @@ #include <cstring> // memcpy #include <random> +#include "common/util.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "crypto/crypto.h" #include "profile_tools.h" @@ -1129,6 +1130,11 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags) if ((result = mdb_env_set_maxdbs(m_env, 20))) throw0(DB_ERROR(lmdb_error("Failed to set max number of dbs: ", result).c_str())); + int threads = tools::get_max_concurrency(); + if (threads > 110 && /* maxreaders default is 126, leave some slots for other read processes */ + (result = mdb_env_set_maxreaders(m_env, threads+16))) + throw0(DB_ERROR(lmdb_error("Failed to set max number of readers: ", result).c_str())); + size_t mapsize = DEFAULT_MAPSIZE; if (db_flags & DBF_FAST) |