-
Notifications
You must be signed in to change notification settings - Fork 6.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
DO NOT MERGE - Experimental Java Native Cached Write Batch #13115
DO NOT MERGE - Experimental Java Native Cached Write Batch #13115
Commits on Nov 15, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e29730f - Browse repository at this point
Copy the full SHA e29730fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3df3191 - Browse repository at this point
Copy the full SHA 3df3191View commit details -
Configuration menu - View commit details
-
Copy full SHA for 69d94f4 - Browse repository at this point
Copy the full SHA 69d94f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for e0daab8 - Browse repository at this point
Copy the full SHA e0daab8View commit details -
Configuration menu - View commit details
-
Copy full SHA for d5070f7 - Browse repository at this point
Copy the full SHA d5070f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5e361f1 - Browse repository at this point
Copy the full SHA 5e361f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for ba3e641 - Browse repository at this point
Copy the full SHA ba3e641View commit details -
Configuration menu - View commit details
-
Copy full SHA for 56d5964 - Browse repository at this point
Copy the full SHA 56d5964View commit details -
Update jmh benchmarks for native write batch
Extend original native write batch jmh tests to help us compare various write batch implementations. So-far-unused WriteBatchJavaCMem as placeholder for alternative implementation of native write batch.
Configuration menu - View commit details
-
Copy full SHA for 141d306 - Browse repository at this point
Copy the full SHA 141d306View commit details -
WriteBatch Java API Performance baseline
- Finish making first prototype WriteBatchJavaNative work for put() - buffers put() requests on Java side - applies batched put() requests to C++ write_batch buffer on flush() - RocksDB.write(options, WriteBatchJavaNative) applies batch to DB - Clean up JMH performance tests for WriteBatchJavaNative vs existing WriteBatch
Configuration menu - View commit details
-
Copy full SHA for e417588 - Browse repository at this point
Copy the full SHA e417588View commit details -
WriteBatchJavaNative UnsupportedOperationException
Give this prototype method UnsupportedOperationException on unimplemented methods so that we donm’t waste time investigating why jmh tests that call no-ops are so fast :-(
Configuration menu - View commit details
-
Copy full SHA for abf3913 - Browse repository at this point
Copy the full SHA abf3913View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5e4876b - Browse repository at this point
Copy the full SHA 5e4876bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5dbc3e9 - Browse repository at this point
Copy the full SHA 5dbc3e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for f6eb81a - Browse repository at this point
Copy the full SHA f6eb81aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7c9343b - Browse repository at this point
Copy the full SHA 7c9343bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 14c42b1 - Browse repository at this point
Copy the full SHA 14c42b1View commit details -
Direct buffer version of write batch java native
Pass contents in direct ByteBuffer (WriteBatchJavaNativeDirect) Refactor out from byte[] version (WriteBatchJavaNativeArray) Fix to pre-expand buffers by size rather than re-run insertion on overflow
Configuration menu - View commit details
-
Copy full SHA for 7c37861 - Browse repository at this point
Copy the full SHA 7c37861View commit details -
jmh writebatch “don’t write the batch to DB” option
“flushToDB” option used for stripping out the cost of the DB write at the end.
Configuration menu - View commit details
-
Copy full SHA for 4f171a8 - Browse repository at this point
Copy the full SHA 4f171a8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 02ac2ef - Browse repository at this point
Copy the full SHA 02ac2efView commit details -
Java write batch - defer creation of native
Refactor array/direct native variants into a single class with different static factories. Add native C++ support methods for creating the write batch on a write() if it doesn’t already exist. Add similar flush methods for creating the write batch on a flush() if it doesn’t already exist. Remove expansion on Java side - buffer is the requested size, behaviour should be to fill that and then flush, OR (TODO) to bypass it entirely (just make diret JNI calls to writebatch as before) for big writes
Configuration menu - View commit details
-
Copy full SHA for b90a3fe - Browse repository at this point
Copy the full SHA b90a3feView commit details -
java native write batch - native methods private
Refactored previously to remove subclass. So protected methods can now be private.
Configuration menu - View commit details
-
Copy full SHA for 513f7e4 - Browse repository at this point
Copy the full SHA 513f7e4View commit details -
java native write batch - handle big put()s
Bypass the java side buffer when put()sare bigger than 50% of the buffer size - which is controlled at constructor time. Doing a big Put() to this kind of write batch causes the buffer to be flushed (if there is anything in it) and then the Put() is performed directly over the JNI to C++ Note that the WriteBatch on the C++ side is created lazily; this may be on a flush of a batch (buffer is full), or it may be on the write of a batch to a DB, or it may be on a bypass write such as the one implemented here.
Configuration menu - View commit details
-
Copy full SHA for 131c1f9 - Browse repository at this point
Copy the full SHA 131c1f9View commit details -
java native write batch - re-order custom layout
A quick step before trying to replicate the layout to the level at which it can be directly memory copied.
Configuration menu - View commit details
-
Copy full SHA for 1bc7551 - Browse repository at this point
Copy the full SHA 1bc7551View commit details -
java native write batch - change to C++ encoding
Pick up an efficient varint encoder from the interwebs Rewrite the encoding using that TODO - the C++ side, so all failing at present
Configuration menu - View commit details
-
Copy full SHA for 603f610 - Browse repository at this point
Copy the full SHA 603f610View commit details -
Copy C++ format write batch from Java
Java-side write batch has same format as C++, so can be memcpy-ed (in theory). In practive it can be assign()-ed to an empty write batch in a single copy. In the case of an existing write batch, the std::string representation does not allow us to append() in 1-copy (because we have to copy into a std::string first to call append()) so we adapt what we did before, and step through the Java representation, calling Put() with Slices manufactured from the entries in the buffer. I think it is OK..
Configuration menu - View commit details
-
Copy full SHA for 99d04d7 - Browse repository at this point
Copy the full SHA 99d04d7View commit details -
Configuration menu - View commit details
-
Copy full SHA for c356592 - Browse repository at this point
Copy the full SHA c356592View commit details -
Re-make jmh tests consistent w/ native write batch
Last few changes to native write batch have modified the API slightly. Some of the test configuration is unnecessary or wrong, and the calls for creation are all part of a single class. Update these appropriately.
Configuration menu - View commit details
-
Copy full SHA for 8286f56 - Browse repository at this point
Copy the full SHA 8286f56View commit details -
java native write batch fix varint32
Translation of Varint32 I had stolen was bugged. Probably my translation is the problem. Use instead the slightly less efficient but more readable and adequately fast version. Fix the Varint32 test(s).
Configuration menu - View commit details
-
Copy full SHA for 79dfe64 - Browse repository at this point
Copy the full SHA 79dfe64View commit details -
java native batch - bulk copy on creating write()
We should have added this optimization as part of the last set of changes. When we are calling write(), and the batch has not been created on the native/C++ side, we can use the same optimization as in flush, to wit: `WriteBatchInternal::SetContents(this, slice)` directly (via Append())
Configuration menu - View commit details
-
Copy full SHA for 327afa7 - Browse repository at this point
Copy the full SHA 327afa7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7cf4a7e - Browse repository at this point
Copy the full SHA 7cf4a7eView commit details -
Configuration menu - View commit details
-
Copy full SHA for c5ea199 - Browse repository at this point
Copy the full SHA c5ea199View commit details -
Update lists of files includes in builds and tests to correctly list the ones for the native write batch changes.
Configuration menu - View commit details
-
Copy full SHA for 90c320f - Browse repository at this point
Copy the full SHA 90c320fView commit details -
Add method to bulk append part of batch as a slice
WriteBatchInternal::AppendContents allows us to append extra batch entries in bulk in a single copy, without the complexity of iteration and individual elements. Hope for improved performance.
Configuration menu - View commit details
-
Copy full SHA for 8ce88ec - Browse repository at this point
Copy the full SHA 8ce88ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for c16b604 - Browse repository at this point
Copy the full SHA c16b604View commit details -
Add jmh run for WriteBatchInternal::AppendContents
WriteBatchInternal::AppendContents is not noticeable better performing, but it is cleaner and we have saved ourselves some code.
Configuration menu - View commit details
-
Copy full SHA for 6789ff9 - Browse repository at this point
Copy the full SHA 6789ff9View commit details -
Configuration menu - View commit details
-
Copy full SHA for dcf11ad - Browse repository at this point
Copy the full SHA dcf11adView commit details -
Configuration menu - View commit details
-
Copy full SHA for 99013f8 - Browse repository at this point
Copy the full SHA 99013f8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a94207 - Browse repository at this point
Copy the full SHA 0a94207View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d3c608 - Browse repository at this point
Copy the full SHA 2d3c608View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7a833d6 - Browse repository at this point
Copy the full SHA 7a833d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for c6d885e - Browse repository at this point
Copy the full SHA c6d885eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c14efb - Browse repository at this point
Copy the full SHA 0c14efbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8d3e486 - Browse repository at this point
Copy the full SHA 8d3e486View commit details -
Configuration menu - View commit details
-
Copy full SHA for 65f282c - Browse repository at this point
Copy the full SHA 65f282cView commit details -
Configuration menu - View commit details
-
Copy full SHA for eb66c81 - Browse repository at this point
Copy the full SHA eb66c81View commit details -
2 performance fixes Java write batch
build an allocator into the write batch so that it can recycle bytebuffers rather than continually re-allocating them. When passing a direct bytebuffer, slice() it first before passing over JNI. This has a huge performance win, there is something (probing, or god forbid, copying) going on when we get the buffer from JNI. We still need to byte arrays, which are by far the slowest.
Configuration menu - View commit details
-
Copy full SHA for eacfed7 - Browse repository at this point
Copy the full SHA eacfed7View commit details -
More JNI write batch performance fixes
Second instance of - When passing a direct bytebuffer, slice() it first before passing over JNI Use critical section instead of env->GetByteArrayElements to avoid a copy of a potentially very large array, only part of which we may need. It has drawbacks, but for demonstrating performance and working round the byte[] version’s performance bug, it is invaluable.
Configuration menu - View commit details
-
Copy full SHA for 135382a - Browse repository at this point
Copy the full SHA 135382aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ebbdbb7 - Browse repository at this point
Copy the full SHA ebbdbb7View commit details -
Revise write batch jmh operations
1 operation now consists of writing a single batch of the required size. Performance is how many batches are written per second.
Configuration menu - View commit details
-
Copy full SHA for d36026e - Browse repository at this point
Copy the full SHA d36026eView commit details -
Configuration menu - View commit details
-
Copy full SHA for b4cfcb8 - Browse repository at this point
Copy the full SHA b4cfcb8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0d409b9 - Browse repository at this point
Copy the full SHA 0d409b9View commit details