Replies: 1 comment
-
@Fatman13 问题是实际修改了这个参数的值,并未生效,传输的时候,还是同时传输多个任务 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
原文:#4627 (comment) by @zl03jsj
我们经过对代码进行详细的分析, 并且通过测试和验证,结论是SimultaneousTransfers这个参数在 venus-market upgrate/nv15 分支是有效果的.
分析如下:
这个参数在venus-market 创建graghsync 实例时, 作为graphsync的一个option传入, 代码位置:
https://github.com/filecoin-project/venus-market/blob/1af26297b00bebc47337f78cf6e8d930c7beb6dd/network/graphsync.go#L27-L60
graphsync会在创建实例对象时, 启动一个taskQueue,来处理request的任务.(market请求数据的任务), 代码位置:
https://github.com/ipfs/go-graphsync/blob/4f4414d6badd10e187bdd0517c63f40e34c14d01/impl/graphsync.go#L295-L297
最后这个requestQueue启动时, 会根据指定的SimultaneousTransfers数量来创建并发worker, 代码位置:
https://github.com/ipfs/go-graphsync/blob/4f4414d6badd10e187bdd0517c63f40e34c14d01/taskqueue/taskqueue.go#L95-L99
每个worker会定时查询是否有任务, 每次找出一个传输任务, 然后执行:executor.ExecuteTask, 执行完成以后再执行下一个, 代码位置:
https://github.com/ipfs/go-graphsync/blob/4f4414d6badd10e187bdd0517c63f40e34c14d01/taskqueue/taskqueue.go#L114-L151
从代码层面看, 这样的处理逻辑是没有问题的.
到这里, 唯一需要验证的问题是, ExecuteTask是一个异步的任务, 由于内部代码非常复杂, 通过查看代码不太容易分析,

我们为了验证, 我们在work执行任务时打出了一些日志, 通过分析日志来做出验证, 从market-client端发起一个存储任务后,
在venus-market端查看日志:
可以证明, taskQueue是数据传输完成之后, 再执行的下一个任务.
Beta Was this translation helpful? Give feedback.
All reactions