Merge pull request #2742

7c7d3672 Increase LMDB maxreaders if large number of threads in use (Howard Chu)
6738753b Use max_concurrency as-is (Howard Chu)
This commit is contained in:
Riccardo Spagni
2017-11-14 15:30:03 +02:00
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -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"
@@ -1135,6 +1136,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)