bitflicker64 commented on code in PR #535:
URL: https://github.com/apache/hugegraph-doc/pull/535#discussion_r4421232755


##########
content/en/docs/quickstart/hugegraph/hugegraph-hstore.md:
##########
@@ -214,12 +215,20 @@ This file contains only `rocksdb` and Actuator exposure 
settings.
 
 | Key | Master distribution value | Code default | Meaning |
 |-----|---------|--------------|---------|
-| `rocksdb.total_memory_size` | `32000000000` | `51539607552` | Memory budget 
shared by all RocksDB instances on this node. When absent or `0`, the node uses 
the JVM max heap instead. |
-| `rocksdb.write_buffer_size` | `32000000` | `33554432` | Memtable size in 
bytes. When absent or `0`, the node uses `total_memory_size / 1000`. |
+| `rocksdb.total_memory_size` | `auto` | Auto-sized, see note | Off-heap 
memory budget shared across all RocksDB instances on this node (`auto` or byte 
count). See below for derivation rules. |
+| `rocksdb.write_buffer_size` | `32000000` | Derived, see Meaning | Memtable 
size in bytes. When absent or `0`, the node uses `total_memory_size / 1000`, at 
least `1048576` (1 MiB). |
 | `rocksdb.min_write_buffer_number_to_merge` | `16` | `16` | Number of 
memtables merged together before a flush. |
 | `rocksdb.write_buffer_ratio` | not set | `0.66` | Share of 
`total_memory_size` given to the write cache. The rest becomes the block cache. 
|
 {.td-table--wide}
 
+### RocksDB memory budget sizing rules {#rocksdb-memory-budget}
+
+> [!NOTE]
+> When `rocksdb.total_memory_size` is set to `auto` (or absent / `0`), the 
node sizes the off-heap RocksDB budget automatically:
+> - **Calculation Formula**: Takes physical memory (using the visible cgroup 
limit in containers) minus JVM maximum heap (`-Xmx`), direct memory 
(`MaxDirectMemorySize`), and a 1.5 GiB system reserve, then allocates half the 
remainder, clamped between 256 MiB and 32 GiB.

Review Comment:
   Minor: the auto-sizing ceiling is `RocksdbMemoryBudget.MAX_AUTO = 
32_000_000_000L`, so 32 GB, not 32 GiB, which overstates it by about 2.4 GB. 
Write "32 GB (`32000000000` bytes)" here and on line 226 of the CN page.



##########
content/en/docs/quickstart/hugegraph/hugegraph-hstore.md:
##########
@@ -214,12 +215,20 @@ This file contains only `rocksdb` and Actuator exposure 
settings.
 
 | Key | Master distribution value | Code default | Meaning |
 |-----|---------|--------------|---------|
-| `rocksdb.total_memory_size` | `32000000000` | `51539607552` | Memory budget 
shared by all RocksDB instances on this node. When absent or `0`, the node uses 
the JVM max heap instead. |
-| `rocksdb.write_buffer_size` | `32000000` | `33554432` | Memtable size in 
bytes. When absent or `0`, the node uses `total_memory_size / 1000`. |
+| `rocksdb.total_memory_size` | `auto` | Auto-sized, see note | Off-heap 
memory budget shared across all RocksDB instances on this node (`auto` or byte 
count). See below for derivation rules. |
+| `rocksdb.write_buffer_size` | `32000000` | Derived, see Meaning | Memtable 
size in bytes. When absent or `0`, the node uses `total_memory_size / 1000`, at 
least `1048576` (1 MiB). |
 | `rocksdb.min_write_buffer_number_to_merge` | `16` | `16` | Number of 
memtables merged together before a flush. |
 | `rocksdb.write_buffer_ratio` | not set | `0.66` | Share of 
`total_memory_size` given to the write cache. The rest becomes the block cache. 
|
 {.td-table--wide}
 
+### RocksDB memory budget sizing rules {#rocksdb-memory-budget}
+
+> [!NOTE]
+> When `rocksdb.total_memory_size` is set to `auto` (or absent / `0`), the 
node sizes the off-heap RocksDB budget automatically:
+> - **Calculation Formula**: Takes physical memory (using the visible cgroup 
limit in containers) minus JVM maximum heap (`-Xmx`), direct memory 
(`MaxDirectMemorySize`), and a 1.5 GiB system reserve, then allocates half the 
remainder, clamped between 256 MiB and 32 GiB.
+> - **Write Cache & Block Cache**: Budget is divided according to 
`rocksdb.write_buffer_ratio` (default 0.66). This is a soft capacity target; 
under heavy concurrent write loads, set `rocksdb.write_buffer_allow_stall` to 
`true` to enforce strict memory bounds.

Review Comment:
   Minor: `write_buffer_allow_stall=true` only stalls writes once memtables 
fill the `WriteBufferManager` share; the block cache is a non-strict 
`LRUCache`, so native memory can still exceed the budget and a container can 
still be OOM-killed. Say it holds the write-cache share at the cost of write 
latency instead of "enforce strict memory bounds", here and on line 227 of the 
CN page.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to