wernerdv commented on PR #13554: URL: https://github.com/apache/ignite/pull/13554#issuecomment-6950341834
### Reservation rework and batch reservation fix (`ef29182`) **Change** - `AbstractFreeList.reserve()`: every claim is added to `reservedPages` up front; an insert evicts only for its own claim plus the missing part of the empty pages pool and does not wait for other inserts. The pool cap, the single accumulating claim, `accumulating`, `evictedCnt` and `clearStalled()` are removed. - `AbstractFreeList.deficit()`: a half of the empty pages pool absorbs the reservations of in-flight inserts; only the reservations above it are kept free in addition to the pool. With up to pool/2 reserved pages the eviction condition does not depend on the reservations, as on master. - `PageEvictionTracker.evictDataPage()` returns `true` only if all entries of the page were evicted, so a counted eviction is a freed page. - `GridDhtAtomicCache.reserveBatchSpace()`: a row larger than half a page is rounded up to whole data pages; smaller rows share pages and fill at least half of every page they take, so they are counted twice. Before, the sum of row sizes was reserved, which under-reserves when rows do not share pages: 100 rows of 2 KB reserved 53 pages and used ~100. **Setup** - `JmhPageEvictionBenchmark`, 4 threads, warmup 3 × 5 s, measurement 5 × 10 s. - In-memory region 256 MB, `RANDOM_LRU`, page size 4 KB, eviction threshold 0.95 on both sides, empty pages pool 100. - JDK Temurin 17.0.18, `-Xms4g -Xmx4g`, Intel Core i5-9400F (6 cores), Linux 6.8. - master = merge-base `ec446ff45af`, before = `4cd9ca9a2fe`, after = `ef29182`. - Value and batch sizes other than the benchmark defaults were set through temporary system properties. **Results, ops/ms** (OOM = `IgniteOutOfMemoryException` within seconds, no measured iteration) | Benchmark | master | before | after | |---|---|---|---| | `putAtThreshold`, 1 KB | 538.1 ± 6.1 | 495.0 ± 2.6 | 535.0 ± 14.4 | | `putAtThreshold`, 8 000 B | 360.0 ± 2.5 | 346.3 ± 5.8 | 351.3 ± 3.9 | | `putAtThreshold`, 512 KB | OOM | 7.31 ± 0.13 | 7.59 ± 0.02 | | `putAllAtThreshold`, 90 × 1 KB | OOM | 7.38 ± 0.16 | 6.72 ± 0.11 | | `putAllAtThreshold`, 100 × 1 KB | OOM | 1.05 ± 0.06 | 5.94 ± 0.21 | | `putAllAtThreshold`, 100 × 2 KB | OOM | 1.30 ± 0.52 | 5.96 ± 0.04 | | `txPutAtThreshold`, 1 KB | 264.6 ± 7.5 | 263.9 ± 5.0 | 255.0 ± 5.2 | - Forks: 2, except 1 for the 2 KB batch row and for the master and "before" cells of the 512 KB and tx rows, and 3 for "before" on 100 × 1 KB. - master on 1 KB puts was measured twice: 523.8 ± 31.2 and 538.1 ± 6.1 (the latter back to back with "after"). - Before the change, batches fell onto the slow path once the claims of concurrent writers exceeded the pool: 4 × 25 pages (90 rows) gives 7.38, 4 × 27 pages (100 rows) gives 1.05. - Batch reservation, 100 × 2 KB, loaded pages over one 65 s fork: before 61 799 → 64 248 (still growing), after 61 805 → 61 879. - Measured separately on an intermediate version: without the pool absorbing reservations, 1 KB puts were at 494.6 ± 10.1; with every batch row rounded up to a whole page, 90 × 1 KB batches were at 6.31 ± 0.20. -- 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]
