aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-03-22 06:17:44 -0700
committerGavin Andresen <gavinandresen@gmail.com>2012-03-22 06:17:44 -0700
commit0e894be626ae15f26f6f1483b38c7e9191bdb638 (patch)
tree695d91032616afb26b10fa366a1814b6ce6a081d /src
parente53f03172a4b6d89c5a65d367c47f6d126692ca6 (diff)
parent89516bd4e00370c78f9f324e1e7b9db78f5a895e (diff)
Merge pull request #964 from sipa/fastblocks
Speed up block downloading
Diffstat (limited to 'src')
-rw-r--r--src/db.cpp7
-rw-r--r--src/init.cpp1
2 files changed, 6 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 0344c7960c..7c3937a49f 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -84,8 +84,11 @@ CDB::CDB(const char* pszFile, const char* pszMode) : pdb(NULL)
string strErrorFile = strDataDir + "/db.log";
printf("dbenv.open strLogDir=%s strErrorFile=%s\n", strLogDir.c_str(), strErrorFile.c_str());
+ int nDbCache = GetArg("-dbcache", 25);
dbenv.set_lg_dir(strLogDir.c_str());
- dbenv.set_lg_max(10000000);
+ dbenv.set_cachesize(nDbCache / 1024, (nDbCache % 1024)*1048576, 1);
+ dbenv.set_lg_bsize(10485760);
+ dbenv.set_lg_max(104857600);
dbenv.set_lk_max_locks(10000);
dbenv.set_lk_max_objects(10000);
dbenv.set_errfile(fopen(strErrorFile.c_str(), "a")); /// debug
@@ -156,7 +159,7 @@ void CDB::Close()
nMinutes = 1;
if (strFile == "addr.dat")
nMinutes = 2;
- if (strFile == "blkindex.dat" && IsInitialBlockDownload() && nBestHeight % 500 != 0)
+ if (strFile == "blkindex.dat" && IsInitialBlockDownload() && nBestHeight % 5000 != 0)
nMinutes = 1;
dbenv.txn_checkpoint(0, nMinutes, 0);
diff --git a/src/init.cpp b/src/init.cpp
index 81e98fe294..6fa56b939f 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -177,6 +177,7 @@ bool AppInit2(int argc, char* argv[])
" -min \t\t " + _("Start minimized") + "\n" +
" -splash \t\t " + _("Show splash screen on startup (default: 1)") + "\n" +
" -datadir=<dir> \t\t " + _("Specify data directory") + "\n" +
+ " -dbcache=<n> \t\t " + _("Set database cache size in megabytes (default: 25)") + "\n" +
" -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)") + "\n" +
" -proxy=<ip:port> \t " + _("Connect through socks4 proxy") + "\n" +
" -dns \t " + _("Allow DNS lookups for addnode and connect") + "\n" +