Repository navigation
Native build: commit every 1000 rows by default in insert_many, graph_batch and create_vertices - #75
Merged
Conversation
…_batch and create_vertices A pre-registered laptop A/B on the columnar native wheel (1M documents through insert_many, 200k vertices and 500k edges through GraphBatch) found 1000-row transactions faster (wall 0.822-0.831 and 0.853-0.864 of the old default) and lighter on the young GC. The native defaults become insert_many commit_every 1000 (was 10,000), graph_batch commit_every 1000 (was unset) and a create_vertices chunk equal to the batch's commit_every (was 10,000). An explicit value wins. The JVM defaults are unchanged and pinned by a source-level test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The native build (the
arcadedbpackage) now commits every 1000 rows by default ininsert_manyandgraph_batch, andcreate_verticessends and commits 1000 rows per call into the image. The JVM build (arcadedb-jvm) keeps its defaults:insert_many10,000,graph_batchunset (one commit per flush),create_vertices100,000 rows per crossing. They are not measured on the JVM yet. Python only: no Java, no rebuild.Where each default lives
insert_many:DEFAULT_INSERT_MANY_COMMIT_EVERY = 1000insrc/arcadedb/_native/database.py, the default ofDatabase.insert_many(commit_every=...). The JVM default stayscommit_every: int = 10_000insrc/arcadedb/core.py.graph_batch:NativeGraphBatch.DEFAULT_COMMIT_EVERY = 1000insrc/arcadedb/_native/extras.py.NativeGraphBatch.createfills it in whencommit_everyisNone(an explicit value,0included, goes through unchanged). The JVMgraph_batchstill leaves it unset.create_vertices: the chunk of a native call is now the batch'scommit_every(NativeGraphBatch._vertex_chunk), so 1000 by default,graph_batch(commit_every=N)gives N, andcommit_every=0falls back to_BULK_CHUNK(10,000). There is no per-call chunk argument, so the batch'scommit_everyis the explicit knob. The JVMGraphBatch._BULK_CHUNKstays 100,000.new_edgesis not part of the measured change: its crossing chunk staysNativeGraphBatch._BULK_CHUNK = 10_000.One correction to the pre-registration: it describes the old
create_verticesdefault as two transactions of 100,000 rows. The 100,000 is the JVM base class value. The native class has overridden it with 10,000 since the native port (NativeGraphBatch._BULK_CHUNK), so the native default moves from 10,000 to 1000, not from 100,000.What changes for users
commit_everyis the number of rows in one transaction. Rows that are already committed stay committed if a later chunk fails, and only the transaction that was open is rolled back. With 1000 instead of 10,000, a failed native load keeps its rows up to a commit that is at most 1000 rows behind the failure. Code that relied on a failedinsert_manyleaving nothing for loads under 10,000 rows must now passcommit_every=0(one transaction) or open its own transaction (insert_manycommits nothing inside the caller's transaction).graph_batch(commit_every=0)gives the old one commit per flush. Passingcommit_every=Noneexplicitly is the same as not passing it.Evidence
A pre-registered laptop A/B on the columnar native wheel: 1,000,000 mixed documents through
insert_many, and 200,000 vertices with 500,000 edges throughGraphBatch(parallel_flush, one client thread).ab.py --noise, ABBA order, 12 clean pairs for each figure. The A/A controls were clean (docs [0.994, 1.008], graph [0.990, 1.003]). Intervals are 95 % intervals of the median per-round ratio, new default over old default.insert_many,commit_every=1000insert_many,commit_every=5000(also passed)GraphBatch,commit_every=1000with 1000-rowcreate_verticescallsThe rule picks the lower median wall ratio when both document sizes pass, so
insert_manygets 1000. The runs used an isolate heap of 80 % of RAM. The default is now 50 % (#74), and smaller commits lower the heap a load needs.Docs
New page
how-to/bulk-loads.adoc(in the nav) with the defaults of both packages side by side, the A/B figures, what changes for a failed load, and how to override. The docstrings ofinsert_many,graph_batch,GraphBatch.create_vertices(JVM build,src/arcadedb/core.py,src/arcadedb/graph_batch.py) and the nativeinsert_manyandgraph_batchsay which default applies where.Tests
tests/test_ingest_defaults.py(both backends, parses the source, starts neither the JVM nor the native library): the JVM defaults are unchanged (10,000;None; 100,000) and the native constants are 1000 with the edge chunk at 10,000.tests/test_native_ingest_defaults.py(native only, listed inconftest.pyfor the other backend): a duplicate key in the third 1000 rows leaves 2000 rows with the default, 1500 withcommit_every=1500, and 0 with 10,000 or 0.graph_batchsendscommit_every=1000to the image by default, an explicit 250 and 0 are sent unchanged, andcreate_verticescrosses in 1000, 250 and 2500 rows respectively (rows and count forms).tests/test_native_columnar_insert.pycounts crossings of one 2,500-row chunk, so an autouse fixture there runsinsert_manywith its oldcommit_everyof 10,000 (the file is about the columnar entry points, not the default).Run with
ARCADEDB_BACKEND=nativeon the newest native image,native-lib/columnar-port/libarcadedb.soin the laptop build dir, built 2026-10-25 22:01 (sha25608a07e401c9b2c7ba16d8595db2e9d3efd2712bf46417d2f0de0590bed9ee47e), foreground, Python 3.13:test_ingest_defaults,test_native_ingest_defaults,test_bulk_insert,test_graph_batch,test_native_columnar_insert,test_dataframe_ingestandtest_core: 227 passed, 4 skipped in 9.06s. bandit 1.9.4 (low severity, low confidence) is clean,scripts/check_no_embedded_name.pyis ok, isort (profile black) and black are applied. The JVM build was not run.🤖 Generated with Claude Code