Commit Graph

1500 Commits

Author SHA1 Message Date
Steve Atherton dadbc26929
Merge pull request #295 from yichic/abort-backup-get-tag
Abort backup get tag
2018-05-03 11:48:59 -07:00
Yichi Chiang c37b48308e Fix the way to get tagName 2018-05-03 11:11:44 -07:00
Steve Atherton e5320fa237
Merge pull request #292 from ajbeamon/printable-encode-backup-beginfile
Encode BeginFile TraceEvent detail with printable
2018-05-01 15:53:48 -07:00
Alec Grieser 8c47e0a086
Merge pull request #278 from vmg/vmg/tuple
bindings/go: Reduce memory allocations when packing tuples
2018-05-01 15:46:20 -07:00
Evan Tschannen 6aba95356e
Merge pull request #291 from yichic/abort-5.1-backup
Abort 5.1 backup for 5.2 upgrade
2018-05-01 15:36:02 -07:00
A.J. Beamon f848c68b73 TraceEvents in FileBackupAgent that include BeginFile should be encoding them with printable because of the possible inclusion of the null byte. This causes the detail to terminate prematurely. 2018-05-01 15:35:48 -07:00
Yichi Chiang 52cc592d5e Abort 5.1 backup for 5.2 upgrade 2018-05-01 14:49:14 -07:00
Alec Grieser 1eea57c5fa
Merge pull request #288 from ajbeamon/release-5.2
Add comment explaining synchronization behavior in high contention allocator
2018-05-01 11:15:14 -07:00
A.J. Beamon 060b655257
Add another line of description to synchronization comment. 2018-05-01 10:00:49 -07:00
A.J. Beamon a8c083509c Add a note about why the high-contention allocator synchronizes on HighContentionAllocator.class rather than Transaction. 2018-05-01 09:31:40 -07:00
Vicent Marti a19af9921e bindings/go: Reduce memory allocations when packing tuples
Memory profiling a FoundationDB layer implemented in Go shows high
memory pressure and increased GC times when performing highly-concurrent
multi-key transactions on the database. Further digging displays that
the source of the memory pressure happens when packing the keys for the
transaction into byte slices: the most salient issue is that memory
during the packing process is allocated based on the number of elements
to pack and not on the total size of the resulting byte slice.

This commit attempts to reduce the amount of memory allocated when
calling `Tuple.Pack` for most (all?) usage patterns, both in number of
allocations and in total allocated size.

The following optimizations have been implemented:

- Remove `bytes.Buffer` usage in `encodeTuple`: the `Buffer` struct is
quite expensive for the key sizes we're looking to generate, both
allocation and performance-wise. A `packer` struct has been implemented
that builds the keys "naively" by using `append` on a slice. Slice
growth in Go is also amortized just like in `bytes.Buffer`.

- Do not use `bytes.Replace` in `encodeBytes`: this function is
particularly expensive because it always allocates a copy of the byte
slice, even when it doesn't contain nil bytes. Instead, the replacement
step has been implemented manually in `packer.putbytesNil`, where it can
perform the replacement optimally into the output byte slice without
allocating memory. By having this local function we also allow the
compiler to not duplicate any input `string`s when casting them to
`[]byte`; previously, a copy of every string to pack was always being
allocated because the compiler couldn't prove that `bytes.Replace`
wouldn't modify the slice.

- Use stack space in `encode[Float|Double|Int]`: all the numerical
packing functions were allocating huge amounts of memory because of the
usage of temporary `bytes.Buffer` objects and `binary.Write` calls. The
sizes for all the packed data are always known (either 4 or 8 bytes
depending on type), so the big endian packing can be performed directly
on the stack with `binary.BigEndian.PutUint[32|64]`, which doesn't
require the `interface{}` conversion for the `binary.Write` API and in
x64 compiles to a `mov + bswap` instruction pair.

As a result of these optimizations, the "average" case of key packing
can now create a key with a single allocation.  More complex key packing
operations, even those that contain strings/byte slices with nil bytes,
now allocate memory in a constant way (i.e. amortized based on the
amount of growth of the output buffer and not the number of Tuple
elements to pack).

Additionally, the reduction of memory allocations and the better usage
of the `binary` APIs produce a very significant reduction in runtime for
key packing: between 2x and 6x faster for all packing operations.

Before/after benchmarks are as follows:

benchmark                                  old ns/op     new ns/op     delta
BenchmarkTuplePacking/Simple-4             310           76.4          -75.35%
BenchmarkTuplePacking/Namespaces-4         495           137           -72.32%
BenchmarkTuplePacking/ManyStrings-4        960           255           -73.44%
BenchmarkTuplePacking/ManyStringsNil-4     1090          392           -64.04%
BenchmarkTuplePacking/ManyBytes-4          1409          399           -71.68%
BenchmarkTuplePacking/ManyBytesNil-4       1364          533           -60.92%
BenchmarkTuplePacking/LargeBytes-4         319           107           -66.46%
BenchmarkTuplePacking/LargeBytesNil-4      638           306           -52.04%
BenchmarkTuplePacking/Integers-4           2764          455           -83.54%
BenchmarkTuplePacking/Floats-4             3478          482           -86.14%
BenchmarkTuplePacking/Doubles-4            3654          575           -84.26%
BenchmarkTuplePacking/UUIDs-4              366           211           -42.35%

benchmark                                  old allocs     new allocs     delta
BenchmarkTuplePacking/Simple-4             6              1              -83.33%
BenchmarkTuplePacking/Namespaces-4         11             1              -90.91%
BenchmarkTuplePacking/ManyStrings-4        18             2              -88.89%
BenchmarkTuplePacking/ManyStringsNil-4     18             2              -88.89%
BenchmarkTuplePacking/ManyBytes-4          23             3              -86.96%
BenchmarkTuplePacking/ManyBytesNil-4       22             2              -90.91%
BenchmarkTuplePacking/LargeBytes-4         3              2              -33.33%
BenchmarkTuplePacking/LargeBytesNil-4      3              2              -33.33%
BenchmarkTuplePacking/Integers-4           63             3              -95.24%
BenchmarkTuplePacking/Floats-4             62             2              -96.77%
BenchmarkTuplePacking/Doubles-4            63             3              -95.24%
BenchmarkTuplePacking/UUIDs-4              2              2              +0.00%

benchmark                                  old bytes     new bytes     delta
BenchmarkTuplePacking/Simple-4             272           64            -76.47%
BenchmarkTuplePacking/Namespaces-4         208           64            -69.23%
BenchmarkTuplePacking/ManyStrings-4        512           192           -62.50%
BenchmarkTuplePacking/ManyStringsNil-4     512           192           -62.50%
BenchmarkTuplePacking/ManyBytes-4          864           448           -48.15%
BenchmarkTuplePacking/ManyBytesNil-4       336           192           -42.86%
BenchmarkTuplePacking/LargeBytes-4         400           192           -52.00%
BenchmarkTuplePacking/LargeBytesNil-4      400           192           -52.00%
BenchmarkTuplePacking/Integers-4           3104          448           -85.57%
BenchmarkTuplePacking/Floats-4             2656          192           -92.77%
BenchmarkTuplePacking/Doubles-4            3104          448           -85.57%
BenchmarkTuplePacking/UUIDs-4              256           192           -25.00%
2018-05-01 10:52:08 +02:00
Vicent Marti 5bab1e8e4e bindings/go: Add tuple packing tests and benchmark
Although the Go bindings to FoundationDB are thoroughly tested as part
of the `bindingtester` operation, this commit implements a more-or-less
complete test case using golden files for the serialized output of
`Tuple.Pack` operations. This will make implementing optimizations and
refactoring the packing operation much simpler.

The same test cases used to verify correctness are also used as a
benchmark suite to measure the amount of memory allocated in the
different operations.
2018-05-01 10:51:57 +02:00
Evan Tschannen 18f345487e
Merge pull request #272 from alecgrieser/merge-release-5.1
Merge release 5.1 into release 5.2
2018-04-27 22:38:17 -07:00
Alec Grieser a1faaafca3
Merge remote-tracking branch 'upstream/release-5.1' into merge-release-5.1 2018-04-27 16:38:18 -07:00
Alec Grieser 5fbfd1eb39
Merge pull request #261 from etschannen/release-5.1
removed binding tester references to dev_null_is_web_scale
2018-04-27 16:36:40 -07:00
Evan Tschannen 9fb31b3e47 updated generated.go 2018-04-27 16:33:57 -07:00
Evan Tschannen 434d896627 removed dev null is web scale from flow tester 2018-04-27 16:14:26 -07:00
Evan Tschannen 9060e6d82b merged in 5.1 2018-04-27 16:13:35 -07:00
Evan Tschannen 0c6ceac762
Merge pull request #265 from yichic/upgrade-dr-to-5.2
Upgrade DR from 5.1 to 5.2
2018-04-27 13:58:01 -07:00
Yichi Chiang c721ab6854 Fix review comments 2018-04-27 13:54:34 -07:00
John Brownlee b2c7290b1e
Merge pull request #270 from alecgrieser/cherrypick-docs-and-formatting-fixes
Cherrypick updates to class scheduling tutorial
2018-04-27 13:01:43 -07:00
Steve M 6a8f1ae2c1
Fixups for python tutorial documentation
The available_classes function is using Subspace.unpack to
obtain the tuple, not fdb.tuple so update the description to
reflect this.

The limited seat tutorial section was missing the code and
text describing the update of the drop function.
2018-04-27 12:54:35 -07:00
Steve Malmskog b1440e5a70
Remove redundant drop function doc section
Drop function description was moved up adjacent to the other
functions to provide better document flow making this section
redundant, hence its removal.
2018-04-27 12:52:33 -07:00
Alec Grieser 61666fc5b0
Merge pull request #269 from brownleej/docs-footer-update
Cherry-pick a docs change onto release-5.1
2018-04-27 12:27:32 -07:00
Dave Lester caee57b50c Updates documentation config / theme footer to reflect project copyright information. 2018-04-27 12:24:52 -07:00
Evan Tschannen d2a684363b remove more dev null is web scale options in the binding testers 2018-04-27 12:22:38 -07:00
John Brownlee 816cceae09
Merge pull request #257 from alecgrieser/cherrypick-docs-and-go-install-fixes
Cherrypick docs and go install fixes
2018-04-27 11:11:54 -07:00
Yichi Chiang 6bddf8aefa Upgrade DR from 5.1 to 5.2 2018-04-26 17:24:40 -07:00
Alec Grieser 117c28287b
Merge pull request #263 from alexmiller-apple/bindings-build-fixes-5.1
Fix "std::istream::ignore(long)" linking errors for bindings
2018-04-26 16:20:16 -07:00
Alex Miller 11bd7d7daf Add a disgusting and terrible hack to avoid "undefined std::istream::ignore(long)" linking errors.
This makes building our bindings in the provided docker image possible again.
2018-04-26 16:07:50 -07:00
Evan Tschannen d67b0e7d54 removed binding tester references to dev_null_is_web_scale 2018-04-26 14:36:17 -07:00
John Brownlee cce5204a22
Merge pull request #260 from etschannen/release-5.1
removed dev_null_is_web_scale
2018-04-26 14:31:49 -07:00
Evan Tschannen e8378115e0 removed dev_null_is_web_scale 2018-04-26 14:10:28 -07:00
Evan Tschannen 2adc66f49e
Removed set_durability_dev_null_is_web_scale 2018-04-26 14:03:00 -07:00
xtreak a76259022d
Make docs Python 3 compatible 2018-04-26 09:45:51 -07:00
Seshadri Mahalingam 2e971295fc
[go] Fix ${fdbdir} path definition in fdb-go-install.sh 2018-04-26 09:45:02 -07:00
John Brownlee e7e4beed9c
Merge pull request #251 from AlvinMooreSr/release-5.1-buildwin
Windows Installer Modified
2018-04-25 09:41:10 -07:00
Alvin Moore 0817ef3a7d Removed extraneous element from Windows installer 2018-04-24 14:37:35 -07:00
Alvin Moore d3b802f79a Fixed the Windows Wix installer 2018-04-24 14:27:51 -07:00
Alvin Moore 4ad22a8d9d Added code to skip license file within Windows installer 2018-04-24 13:34:25 -07:00
John Brownlee b651156b24
Merge pull request #247 from alecgrieser/cherrypick-docs-and-formatting-fixes
Cherrypick docs and formatting fixes
2018-04-24 11:08:28 -07:00
Matias Insaurralde 731a8dcdd9
Simplify Go code following the linter recommendations 2018-04-24 10:02:19 -07:00
Martin Junker a6e3c75d9d
add more missing curly brackets 2018-04-24 09:36:36 -07:00
Martin Junker c20be65c02
add missing curly bracket 2018-04-24 09:36:30 -07:00
Alvin Moore 6b9fda14e0 Removed license from windows installer 2018-04-23 11:04:44 -07:00
John Brownlee fc1adfb138
Merge pull request #240 from alecgrieser/cherrypick-docs-and-formatting-fixes
Cherrypick a few changes to release-5.1
2018-04-23 10:13:05 -07:00
tracebundy dd36f55a90
Update fdbserver.actor.cpp
fix the bug 'fdbserver/fdbserver.actor.cpp:761:16: error: aggregate ‘std::ifstream ifs’ has incomplete type and cannot be defined'
2018-04-23 10:06:15 -07:00
Amanda Aizuss 256d7d030d
Convert bindings spec files to markdown
* The initial plaintext file converts nicely - this just converts operations to small headers and uses &lt; and &gt; to make sure text in <> shows up
* Use inline code in a few places where it makes sense
2018-04-23 10:05:34 -07:00
Ben Halverson 7bb332ab64
docs(architecture.html): The architecture image was missing
184
2018-04-23 10:05:09 -07:00
Alec Grieser 04dfca32d5
Merge pull request #226 from ajbeamon/release-5.1
Documentation/Formatting changes
2018-04-22 12:03:28 -07:00