-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf issue: ipfs add
file ~1.5 GB
#234
Comments
Woah, that's crazy. Is there a similar graph showing the used memory? Also, i think part of the issue is we read the whole file. We should be able to add a 1.5GB file to IPFS without using more than 1MB of memory (above the standard Go process mem usage) sequentially (so xN for parallelism, but i think right now ipfs add is all sequential). |
This is a different file. This time, ~1.7 GB. (Performance is different for files that already exist. Don't want to go through trouble of wiping db) Peak Mem: 7.2 GB (hit swap. thrashed 15 GB in/out) On the brightside, our performance metrics have so much room to grow! #optimism #growth-potential #cs149
|
Haha. Yeah, we're doing it wrong. io.Reader + chunking should do it fine. |
Huh... why aren't using the dagwriter? It solves this problem |
isnt it? add was written before dagwriter. that's probably why. |
What do you guys make of the LevelDB perf issue? The memory pressure and LevelDB compaction appear to be independent. |
Yeah, I'll switch that over and report back results |
Thank you @whyrusleeping After #236, adding a 540 MB file exhibits sane memory R/W patterns, trivial peak allocation. |
@jbenet 1.7 GB NB: This test was performed on OS X. Profiles are known to be inaccurate on this OS. See http://golang.org/issue/6047 |
Whoah |
https://github.com/jbenet/go-ipfs/blob/master/unixfs/io/dagwriter.go#L13 |
Simply compile your binary with CPU (or Mem) profiling enabled. pprof.StartCPUProfile(ofi) // at beginning
doWork()
defer pprof.StopCPUProfile() // when you want to stop pprof.WriteHeapProfile(mprof) // at the end of execution Then, run your program. On exit, files are created with profiling information, one for CPU (and one for Mem). Run
In this example, This opens a repl.
Run |
Ok, so I tried a dumb parallelizing dagwriter writing to leveldb, because i thought that perhaps there was a slowdown in the sequential leveldb compress-(cpu)-then-write-(disk) cycle. But it doesn't help at all (here's the code for that just in case it's wanted later: b16b5b9d03da) |
To document things we've considered. Feel free to edit.
|
I'm going to measure perf with snappy compression disabled. |
If we pre-compress raw blocks the extra snappy step may not help much. |
With no snappy compression: https://github.com/jbenet/go-ipfs/compare/perf/no-snappy-compression?expand=1 |
As of 3270ab0, seeing substantial improvements on yesterday's data sets. Now, disk latency appears to be the rate limiting factor. That's a good sign. Memory use stays below 80 MB. CPU time is spent in a manner that appears reasonable. For the curious, the graphs below show the hot spots where CPU time is spent and RAM is allocated.
Unless there are any objections, my recommendation is that we close this issue. For specific performance concerns that arise in the future, we can open new issues. |
CPU profiling on 1.7 GB file at 3270ab0 (Linux) |
Mem profiling on 1.7 GB file at 3270ab0 (Linux) |
👍 |
executing
ipfs add
on 1.5 GB file at 3a0bbe2The same command executed on a 500 MB file consumed 2.13 GB at peak. Extrapolating wildly, this is ~4x overhead.
We may want to start benchmarking operations on data characteristic of common usage patterns. Next week, I can throw up a Jenkins box to return these jobs regularly.
😠 You're killin' me Smalls.
The text was updated successfully, but these errors were encountered: