Commit Graph

305 Commits

Author SHA1 Message Date
Alex Miller a3601af2a6
Merge pull request #435 from Liuchang0812/wip-rename-future-in-c-binding
rename opaque types in c binding to avoid conflicts with the standard library
2018-06-18 13:55:33 -07:00
Chang Liu 5492ea7f8c rename opaque types in c binding to avoid conflicts with the standard library
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
2018-06-13 11:09:42 +08:00
A.J. Beamon a1901701d6
Merge pull request #449 from jkominek/python-getfullargspec
use inspect.getfullargspec when available
2018-06-12 11:58:04 -07:00
A.J. Beamon e5488419cc Attempt to normalize trace events:
* Detail names now all start with an uppercase character and contain no underscores. Ideally these should be head-first camel case, though that was harder to check.
* Type names have the same rules, except they allow one underscore (to support a usage pattern Context_Type). The first character after the underscore is also uppercase.
* Use seconds instead of milliseconds in details.

Added a check when events are logged in simulation that logs a message to stderr if the first two rules above aren't followed.

This probably doesn't address every instance of the above problems, but all of the events I was able to hit in simulation pass the check.
2018-06-08 11:11:08 -07:00
Jay Kominek fb33412b3a use inspect.getfullargspec when available
getargspec was deprecated in python3, this should use
getfullargspec when available, and degrade gracefully
otherwise.
2018-06-08 01:07:18 -06:00
Alec Grieser 5e61fb30d6
Merge remote-tracking branch 'upstream/release-5.2' into merge-release-5.2 2018-05-30 12:02:36 -07:00
Alec Grieser 0c2e801d40
Merge remote-tracking branch 'upstream/release-5.1' into merge-release-5.1 2018-05-30 11:49:29 -07:00
Alec Grieser 1a0175bb01
Merge pull request #395 from dkoston/go-client-readme-add-mono
bindings/go: README.md: Add mono as dependency, add note about fdbver
2018-05-29 10:22:25 -07:00
Dave Koston 1a415a30b6 bindings/go: README.md: Add mono as dependency
Mono is required to install the go bindings on macOS and Windows (build-time only)
2018-05-29 10:31:37 -05:00
A.J. Beamon 026458baf3 Merge release-5.2 into master 2018-05-23 15:32:56 -07:00
A.J. Beamon e172a7f6f1 Fix spacing in build file 2018-05-23 15:01:13 -07:00
Alvin Moore 83c1754181 Modified the groupId to org.foundationdb 2018-05-17 12:53:57 -07:00
Alec Grieser e4cb178083
update api version to 520 in some flow tests 2018-05-10 18:12:41 -07:00
Alec Grieser a3e52424da
actually pass along new versionstamp position in nested versionstamp
addresses #356
2018-05-10 16:11:42 -07:00
Alec Grieser e5378083ec
honor length in Tuple.fromBytes when passed in
addresses #362
2018-05-10 15:27:01 -07:00
Alec Grieser 5ec391695b
regenerate generated.go with new TLS options 2018-05-10 15:26:25 -07:00
Evan Tschannen 8f984cb2c9 Merge branch 'release-5.2'
# Conflicts:
#	fdbrpc/TLSConnection.h
2018-05-10 09:13:22 -07:00
Alec Grieser b7f0e358b3
Merge pull request #340 from ajbeamon/move-thread-shutdown-hook-to-iclientapi
Move addNetworkThreadCompletionHook to IClientApi.
2018-05-09 14:45:50 -07:00
A.J. Beamon cfd50d83d4 Add comment and remove whitespace 2018-05-09 14:38:11 -07:00
A.J. Beamon 499a3c78dc Line ending fix 2018-05-09 10:32:02 -07:00
A.J. Beamon 33ba98c82c Fix indent 2018-05-09 10:12:37 -07:00
A.J. Beamon 330ac4875c Add flag to disable directory snapshot ops in the binding tester and use it in the flow bindings. 2018-05-09 10:12:37 -07:00
Alec Grieser 28ca911b6d
Merge pull request #341 from ajbeamon/bindingtester-flag-to-disable-directory-snapshot-ops
Add flag to disable directory snapshot ops in the binding tester
2018-05-09 10:00:02 -07:00
Justin Lowery 10410ca8cc
Remove empty line 2018-05-09 12:54:25 -04:00
A.J. Beamon 09937b8de7 Fix indent 2018-05-09 09:24:34 -07:00
Alec Grieser f3093642b3
Merge pull request #242 from alecgrieser/32437306-better-versionstamped-value
Unify SET_VERSIONSTAMPED_KEY and SET_VERSIONSTAMPED_VALUE API
2018-05-09 09:04:07 -07:00
Justin Lowery fa29a1b30c
Improve comment consistency in Go tuple package
Updates the first list of supported types, that can be encoded using a Tuple, to match the types that can be found in later comments within the tuple package.
2018-05-09 09:52:25 -04:00
A.J. Beamon 07273fb530 Add flag to disable directory snapshot ops in the binding tester and use it in the flow bindings. 2018-05-08 16:38:10 -07:00
A.J. Beamon 01a3360982 Move addNetworkThreadCompletionHook to IClientApi. 2018-05-08 16:33:43 -07:00
Evan Tschannen 7acdc314e4 Merge branch 'release-5.2'
# Conflicts:
#	fdbrpc/TLSConnection.actor.cpp
2018-05-08 13:22:53 -07:00
Evan Tschannen 1f6c6a886b Merge branch 'release-5.1' into release-5.2 2018-05-08 13:08:11 -07:00
A.J. Beamon ca720e1540
Merge pull request #297 from apple/release-5.2
Merge 5.2 to Master
2018-05-08 12:04:20 -07:00
Alec Grieser 47c9e4f923
update bindings and bindingtester that uses versionstamps to use new protocol
issue #148
2018-05-08 08:57:09 -07:00
Alec Grieser 6ee14bbb93
expose second versionstamp value type through vexillographer and add support in bindings and bindingtester 2018-05-08 08:57:09 -07:00
Julien Blache 83f86aa26f Switch repository clone URL from SSH to HTTPS 2018-05-07 15:20:48 -07:00
Julien Blache 899a173526 Check for FDB C library early on, add /usr/lib64 to Linux search path
Getting a warning at the end of the script is confusing as to the status
of the operation. Did it complete? Partially complete? What was done? It
also wastes time as the repo download comes first.

On Linux, the library may be in /usr/lib64 in many cases, so check for
the library in that path too.
2018-05-07 15:16:22 -07:00
Julien Blache 029373835c Cleanup CGO_*FLAGS
Use CGO_CPPFLAGS, remove non-ld options from CGO_LDFLAGS.
2018-05-04 19:15:48 -07:00
A.J. Beamon 6502d790b9 Remove extra call to create transaction. Cleanup created transactions. 2018-05-04 09:06:47 -07:00
A.J. Beamon d5f69ff596
Merge pull request #296 from apple/release-5.1
Merge Release 5.1 Into Release 5.2
2018-05-03 12:05:35 -07:00
John Brownlee 1739c82c1b Fixes the links to download the client libraries in our documentation and packages. 2018-05-01 16:10:51 -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
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
Iuri Sitinschi d52f8eb255 java binding: remove unnecessary collection wrapper 2018-04-30 10:05:53 -07:00
A.J. Beamon b359e57e78
Merge pull request #276 from isitinschi/master
java binding: remove unnecessary collection wrapper
2018-04-30 10:04:57 -07:00
Iuri Sitinschi 97360e77af java binding: remove unnecessary collection wrapper 2018-04-29 12:20:07 +02:00
Alec Grieser ed807a4f78
update generated.go to include first_in_batch 2018-04-28 17:50:49 -07:00
Alec Grieser 69e831d522
Merge remote-tracking branch 'upstream/release-5.2' into merge-release-5.2 2018-04-28 17:44:52 -07:00