Commit Graph

221 Commits

Author SHA1 Message Date
Juan Batiz-Benet
6e705e1ef0 bitswap/provide: improved rate limiting
this PR greatly speeds up providing and add.

(1) Instead of idling workers, we move to a ratelimiter-based worker.
We put this max at 512, so that means _up to_ 512 goroutines. This
is very small load on the node, as each worker is providing to the
dht, which means mostly waiting. It DOES put a large load on the DHT.
but i want to try this out for a while and see if it's a problem.
We can decide later if it is a problem for the network (nothing
stops anyone from re-compiling, but the defaults of course matter).

(2) We add a buffer size for provideKeys, which means that we block
the add process much less. this is a very cheap buffer, as it only
stores keys (it may be even cheaper with a lock + ring buffer
instead of a channel...). This makes add blazing fast-- it was being
rate limited by providing. Add should not be ratelimited by providing
(much, if any) as the user wants to just store the stuff in the local
node's repo. This buffer is initially set to 4096, which means:

  4096 * keysize (~258 bytes + go overhead) ~ 1-1.5MB

this buffer only last a few sec to mins, and is an ok thing to do
for the sake of very fast adds. (this could be a configurable
paramter, certainly for low-mem footprint use cases). At the moment
this is not much, compared to block sizes.

(3) We make the providing EventBegin() + Done(), so that we can
track how long a provide takes, and we can remove workers as they
finish in bsdash and similar tools.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-04 20:07:25 +02:00
Jeromy
fdf4423c8b fix race introduced in bitswap
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-14 11:11:16 -07:00
Jeromy
a25352d80e publish block before writing to disk
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-13 11:24:49 -07:00
Jeromy
7ef1a470c7 allow bitswap to attempt to write blocks to disk multiple times
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-13 11:01:01 -07:00
Jeromy
ff1bf3058e add in some events to bitswap to emit worker information
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-07 12:14:57 -07:00
rht
4b086eff5a Remove Notice{,f} logging interface
And substitute the lines using Notice{,f} with Info{,f}

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-06-18 10:03:57 +07:00
Jeromy
ef294431d4 move util.Key into its own package under blocks 2015-06-01 16:10:08 -07:00
Jeromy
2ec4c9ac45 handle error 2015-05-29 18:28:50 -07:00
Jeromy
11de364384 parallelize block processing 2015-05-29 18:28:50 -07:00
Jeromy
ab161cf6b4 clean up organization of receivemessage and fix race 2015-05-29 18:28:50 -07:00
Jeromy
efa442ada2 adjust naming 2015-05-29 18:28:50 -07:00
Jeromy
f574cd4b80 Move findproviders out of main block request path
This PR moves the addition of new blocks to our wantlist (and their
subsequent broadcast to the network) outside of the clientWorker loop.
This allows blocks to more quickly propogate to peers we are already
connected to, where before we had to wait for the previous findProviders
call in clientworker to complete before we could notify our partners of
the next blocks that we want. I then changed the naming of the
clientWorker and related variables to be a bit more appropriate to the
model. Although the clientWorker (now named providerConnector) feels a
bit awkward and should probably be changed.

fix test assumption
2015-05-29 18:28:36 -07:00
Jeromy
a3356b0417 fix minor data race in bitswap 2015-05-22 13:39:03 -07:00
Jeromy
c273a3bd4f better bitswap logging 2015-05-21 03:08:32 -04:00
Jeromy
829b88420e explicitly set bitswap message fullness 2015-05-21 03:08:31 -04:00
Jeromy
6ab4bfea95 turn tests down a bit and better context passing 2015-05-21 03:08:31 -04:00
Jeromy
32da687774 fix race bugs 2015-05-21 03:08:31 -04:00
Jeromy
6bf33ad62f WIP: super awesome bitswap cleanup fixtime 2015-05-21 03:08:31 -04:00
Jeromy
ef967ceeef contextify peermanager 2015-05-21 03:08:31 -04:00
Jeromy
a159e6825c implement peermanager to control outgoing messages
Also more refactoring of bitswap in general, including some perf
improvements and eventlog removal.

clean up, and buffer channels

move some things around

correctly buffer work messages

more cleanup, and improve test perf

remove unneccessary test

revert changes to bitswap message, they werent necessary
2015-05-21 03:08:30 -04:00
Jeromy
9049dae674 address comments from CR 2015-05-06 01:35:59 -07:00
Jeromy Johnson
0324b4b283 mild refactor of bitswap 2015-05-06 01:35:57 -07:00
Jeromy
6f04302a48 remove logging of dup blocks, move to counters for bitswap stat 2015-05-04 03:12:17 -07:00
Jeromy
f998339acb remove some redundant blockputs to avoid false duplicate block receives 2015-04-29 19:59:18 -07:00
Jeromy
ea2375e8b4 let wantlist command show other peers wantlists 2015-04-28 01:51:30 -07:00
Juan Batiz-Benet
140cd1fd1b remove debugerrors
We now consider debugerrors harmful: we've run into cases where
debugerror.Wrap() hid valuable error information (err == io.EOF?).
I've removed them from the main code, but left them in some tests.
Go errors are lacking, but unfortunately, this isn't the solution.

It is possible that debugerros.New or debugerrors.Errorf should
remain still (i.e. only remove debugerrors.Wrap) but we don't use
these errors often enough to keep.
2015-04-20 00:35:35 -07:00
Ho-Sheng Hsiao
bf22aeec0a Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00
Jeromy
5eb08c4473 add warning comment about possibly leaked goroutines 2015-03-09 00:22:14 -07:00
Jeromy
8ed0f4b854 respect contexts in a more timely manner 2015-03-08 14:10:02 -07:00
Juan Batiz-Benet
1d5b903611 added cancel func calls previously ignored 2015-03-07 09:31:46 -08:00
Jeromy
8937f5fbda implement a worker to consolidate HasBlock provide calls into one to alieviate memory pressure 2015-03-05 15:18:57 -08:00
Jeromy
98a183d53e fix output formatting on stat 2015-02-27 00:12:21 -08:00
Jeromy
b514478f32 rename wantlist to bitswap, add stat command 2015-02-27 00:12:21 -08:00
Jeromy
559a241566 implement a simple wantlist command to allow the user to view their wantlist 2015-02-27 00:12:21 -08:00
Jeromy
8256b18058 make sure not to orphan any extra goroutines 2015-02-26 23:22:12 -08:00
Jeromy
9c66f65410 make wantlist updates to connected peers happen async, dramatically improves performance between connected nodes 2015-02-26 23:22:12 -08:00
Henry
92d08db7a5 rewrote import paths of go.net/context to use golang.org/x/context
- updated go-ctxgroup and goprocess
ctxgroup: AddChildGroup was changed to AddChild. Used in two files:
- p2p/net/mock/mock_net.go
- routing/dht/dht.go

- updated context from hg repo to git
prev. commit in hg was ad01a6fcc8a19d3a4478c836895ffe883bd2ceab. (context: make parentCancelCtx iterative)
represents commit 84f8955a887232b6308d79c68b8db44f64df455c in git repo

- updated context to master (b6fdb7d8a4ccefede406f8fe0f017fb58265054c)

Aaron Jacobs (2):
net/context: Don't accept a context in the DoSomethingSlow example.
context: Be clear that users must cancel the result of WithCancel.

Andrew Gerrand (1):
go.net: use golang.org/x/... import paths

Bryan C. Mills (1):
net/context: Don't leak goroutines in Done example.

Damien Neil (1):
context: fix removal of cancelled timer contexts from parent

David Symonds (2):
context: Fix WithValue example code.
net: add import comments.

Sameer Ajmani (1):
context: fix TestAllocs to account for ints in interfaces
2015-02-25 11:58:19 +01:00
Jeromy
d7eb57f48f add worker to bitswap for reproviding new blocks 2015-02-19 20:07:02 -08:00
Jeromy
a29c0fc751 move blocking calls out of single threaded loops, cancel contexts ASAP 2015-02-19 06:04:39 +00:00
Jeromy
de057f60dd fix a panic caused by context cancelling closing a promise channel 2015-02-12 23:47:11 +00:00
Juan Batiz-Benet
58f39687cf logs: removed all log.Errors unhelpful to users
Let's save log.Error for things the user can take action on.
Moved all our diagnostics to log.Debug. We can ideally reduce them
even further.
2015-02-03 01:06:07 -08:00
Brian Tiger Chow
195c2f3e28 log(bitswap) add message when message received 2015-02-01 22:08:49 -08:00
Brian Tiger Chow
800a3eb940 refactor(bitswap) move workers to bottom of file 2015-02-01 22:08:49 -08:00
Brian Tiger Chow
d9a8cfbd72 feat(bitswap) add deliverBlocks Event 2015-02-01 22:08:49 -08:00
Brian Tiger Chow
4ae02bc022 fix(bitswap) rename PeerToQuery to send wantlist
log(bitswap) remove ambiguous event
2015-02-01 22:08:49 -08:00
Brian Tiger Chow
d78b76ddb4 log(bitswap) add bitswap loggable 2015-02-01 22:08:49 -08:00
Brian Tiger Chow
c114b04ae1 feat(bitswap): synchronous close 2015-02-01 21:54:19 -08:00
Brian Tiger Chow
0ec0a6ab87 fix inflection 2015-01-30 06:57:41 -08:00
Brian Tiger Chow
6c2d799cb9 periodically print the number of keys in the wantlist (if any) 2015-01-30 06:57:41 -08:00
Brian Tiger Chow
351631a580 pass as param 2015-01-30 06:57:41 -08:00