回复:RFC:随发布压缩包附带区块链 1-74000?
原始发布页
打开来源页面查看 1 个交叉存档
我在一块用了 7 年的慢速硬盘上测试了它,带宽和 CPU 显然都不是瓶颈。初始下载耗时 1 小时 20 分钟。
如果耗时比这长很多,尤其是到了 24 小时,那一定是正在从一个非常慢的节点下载,或者你的连接速度远低于每秒约 15KB(120kbps),又或者是其他地方出了问题。遇到这种情况时,如果能知道看起来是什么造成了瓶颈,会很有帮助。
大约每隔 10 分钟发送最新区块时,它应该有机会切换到更快的节点。最新区块被广播时,它会向其他节点请求接下来的 500 个区块,并从发送速度最快的那个节点继续下载。至少,它本该这样工作。
引用自:jgarzik,2010 年 11 月 26 日 02:07:43 AM
引用自:satoshi,2010 年 11 月 25 日 05:51:39 PM
也许 Berkeley DB 有一些可供调整的设置,能让我们启用或增加缓存内存。
下载时,你需要 ACID 的哪些特性?
可能只需要增加读取缓存。为了建立索引,它不得不在 blk0001.dat 和 blkindex.dat 各处随机读取。它不能假设文件比内存小,尽管目前确实仍是如此。缓存会很有效,因为大多数依赖项都是近期的。
应该有人试验不同的 Berkeley DB 设置,看看是否有某种设置能让下载速度显著加快。如果发现了实质性的改进,我们就可以再研究具体细节。
引用
添加 BDB 记录只是在日志文件末尾追加,直到你执行检查点。随后,检查点会更新主数据库文件。
我们每 500 个区块执行一次检查点。
英文原文
展开英文原文
I tested it on a slow 7 year old drive, where bandwidth and CPU were clearly not the bottleneck. Initial download took 1 hour 20 minutes.
If it's taking a lot longer than that, certainly 24 hours, then it must be downloading from a very slow node, or your connection is much slower than around 15KB per sec (120kbps), or something else is wrong. It would be nice to know what appears to be the bottleneck when that happens.
Every 10 minutes or so when the latest block is sent, it should have the chance to change to a faster node. When the latest block is broadcast, it requests the next 500 blocks from other nodes, and continues the download from the one that sends it fastest. At least, that's how it should work.
Quote from: jgarzik on November 26, 2010, 02:07:43 AM
Quote from: satoshi on November 25, 2010, 05:51:39 PM
Maybe Berkeley DB has some tweaks we can make to enable or increase cache memory.
Which of the ACID properties do you need, while downloading?
It may only need more read caching. It has to read randomly all over blk0001.dat and blkindex.dat to index. It can't assume the file is smaller than memory, although it currently still is. Caching would be effective, since most dependencies are recent.
Someone should experiment with different Berkeley DB settings and see if there's something that makes the download substantially faster. If something substantial is discovered, then we can work out the particulars.
Quote
Adding BDB records is simply appending to a log file, until you issue a checkpoint. The checkpoint then updates the main database file.
We checkpoint every 500 blocks.