Commit Graph

431 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
Karthik Bala
0e597b3ae6 add transport logic to mocknet
License: MIT
Signed-off-by: Karthik Bala <karthikbala444@gmail.com>
2015-07-15 19:36:15 -07:00
Juan Batiz-Benet
a95ce17bd1 Merge pull request #1478 from ipfs/fix/slow-stop
making the daemon shutdown quicker
2015-07-14 15:55:07 -07:00
Jeromy
191ac62c12 making the daemon shutdown quicker
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-14 14:04:56 -07: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
Juan Batiz-Benet
6e9c72ab37 expose internal/pb packages.
we shouldn't use internal packages.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-10 11:08:49 -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
18f5fcea28 golint util/, thirdparty/
and exchange/bitswap/testutils.go

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-06-18 10:03: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
Juan Batiz-Benet
848502de1b Merge pull request #1367 from ipfs/wantmanager-cleanup
select with context when sending on channels
2015-06-12 15:14:09 -07:00
Jeromy
b12cc09f64 select with context when sending on channels
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-12 11:32:06 -07:00
Jeromy
e014a66bf5 comments from CR
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-11 16:43:21 -07:00
Jeromy
c5b40b3b02 prevent wantmanager from leaking goroutines (and memory)
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-11 09:38:09 -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
rht
3547f7ae33 Replace 'var * bytes.Buffer' with '\1 := new(bytes.Buffer)' 2015-05-26 23:18:04 +07:00
Jeromy
a3356b0417 fix minor data race in bitswap 2015-05-22 13:39:03 -07:00
Jeromy
eff73ccce7 error -> notice, bitswap 2015-05-21 21:24:42 -07:00
Jeromy
ce0d2f46d6 defer tock.Stop() 2015-05-21 03:08:32 -04:00
Jeromy
2f934e8c58 warning -> notice 2015-05-21 03:08:32 -04:00
Jeromy
b71a0aced0 clarify synhronization constructs 2015-05-21 03:08:32 -04:00
Jeromy
c273a3bd4f better bitswap logging 2015-05-21 03:08:32 -04:00
Jeromy
2882c793e2 add a distribution test with the rebroadcast delay disabled 2015-05-21 03:08:32 -04:00
Juan Batiz-Benet
2eac921e1d fixup the bitswap readme 2015-05-21 03:08:32 -04:00
Jeromy
829b88420e explicitly set bitswap message fullness 2015-05-21 03:08:31 -04:00
Jeromy
594c7786c3 turn rebroadcast back on 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
65f815a27b move taskdone inside lock boundaries 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
8443b99c1d update comments and reintroduce test 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
225b58e31a remove inflect package 2015-05-20 15:09:20 -07:00
Juan Batiz-Benet
bc6911ef37 bitswap/test: fix timeout on travis 2015-05-19 16:53:13 -04:00
rht
ac7edddb94 Run 'gofmt -s -w' on these files 2015-05-19 06:11:15 +07: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
Juan Batiz-Benet
99596435a7 Merge pull request #1166 from ipfs/fix/bitswap-multisend
try harder to not send duplicate blocks
2015-05-05 00:07:53 -04:00
Jeromy
6f04302a48 remove logging of dup blocks, move to counters for bitswap stat 2015-05-04 03:12:17 -07:00
Jeromy
867186c054 dont create a new ticker each loop 2015-05-01 23:11:40 -07:00
Jeromy
f998339acb remove some redundant blockputs to avoid false duplicate block receives 2015-04-29 19:59:18 -07:00
Jeromy
86fb07aed7 try harder to not send duplicate blocks 2015-04-29 01:36:47 -07:00
Henry
5fff7742f3 godeps: move (go)goprotobuf to github location 2015-04-28 13:42:22 +02:00