~bigbes/tarantool-etcd · parade

main · last commit 1 month ago · 2npkec0r

← Back to the parade

tarantool-etcd-rzr nghttp2 unary send-path rewrite — close parallel KVGet gap, drop jit.off Lined Up

status: open P2 task milestone:m3-performance
bd update tarantool-etcd-rzr --claim bd close tarantool-etcd-rzr
Created byEugene Blikh
Ownerbigbes@gmail.com
Created2026-05-19T13:34:42Z
Updated2026-05-19T13:34:42Z
Description
Parallel KVGet on tarantool is ~70% slower than etcd at GOMAXPROCS=6 (12 688 ops/s vs 21 900 ops/s; p95 970 µs vs 405 µs — docs/BENCH.md "Linux x86_64 — KVGet matrix, 2026-05-15"). Root cause: per-Connection IO mutex in lib/nghttp2/grpc.lua (Connection:_locked) — nghttp2 sessions are not reentrant, so every fiber's submit_response + send_all + sock:write serializes. Etcd has no such constraint.

Fix: pre-build HEADERS + DATA + trailers in pure Lua, skip nghttp2's C→Lua data-source callback on the unary send path, recover ~10–20% throughput lost to jit.off + drop the JIT pin entirely.
Design
See memory project_nghttp2_send_callback_rewrite for the plan. Pre-frame DATA in Lua, avoid re-entering nghttp2 mid-send. Touch points:
- lib/nghttp2/grpc.lua (Connection, _locked, send_response)
- lib/nghttp2/ffi.lua (data-source callback signature)
- M.recv/M.send/M.send_all/M.send_data currently pinned jit.off — un-pin once the callback re-entry is gone (memory feedback_nghttp2_session_not_reentrant explains the original panic).
Acceptance criteria
1. BenchmarkKVGetParallel/point closes the gap to within ~10% of etcd at GOMAXPROCS=6.
2. p95 latency under parallel load drops below 600 µs.
3. No bad-callback panics across 10 verbose runs (the regression test from commit d0fa396).
4. jit.off removed from M.recv/M.send/M.send_all/M.send_data.
Notes
Sources: docs/BENCH.md "Linux x86_64" + memory notes project_nghttp2_send_callback_rewrite, feedback_nghttp2_session_not_reentrant, feedback_nghttp2_dual_connection.

Depends on

Depended on by

Nothing depends on this issue.

No comments.

  • Eugene Blikh created the issue · 2026-05-19T16:34:41Z
  • Eugene Blikh added under epic tarantool-etcd-95d · 2026-05-20T09:56:06Z
  • Eugene Blikh added label milestone:m3-performance · 2026-05-21T14:37:07Z
Stored rows — what this pane was built from, as read
issues 1 row
id tarantool-etcd-rzr
content_hash 3973dcbaf27d8ffaf25bdad2afcfcbfeb9e6deb07cd8ecf62c5a6446247c3468
title nghttp2 unary send-path rewrite — close parallel KVGet gap, drop jit.off
description Parallel KVGet on tarantool is ~70% slower than etcd at GOMAXPROCS=6 (12 688 ops/s vs 21 900 ops/s; p95 970 µs vs 405 µs — docs/BENCH.md "Linux x86_64 — KVGet matrix, 2026-05-15"). Root cause: per-Connection IO mutex in lib/nghttp2/grpc.lua (Connection:_locked) — nghttp2 sessions are not reentrant, so every fiber's submit_response + send_all + sock:write serializes. Etcd has no such constraint. Fix: pre-build HEADERS + DATA + trailers in pure Lua, skip nghttp2's C→Lua data-source callback on the unary send path, recover ~10–20% throughput lost to jit.off + drop the JIT pin entirely.
design See memory project_nghttp2_send_callback_rewrite for the plan. Pre-frame DATA in Lua, avoid re-entering nghttp2 mid-send. Touch points: - lib/nghttp2/grpc.lua (Connection, _locked, send_response) - lib/nghttp2/ffi.lua (data-source callback signature) - M.recv/M.send/M.send_all/M.send_data currently pinned jit.off — un-pin once the callback re-entry is gone (memory feedback_nghttp2_session_not_reentrant explains the original panic).
acceptance_criteria 1. BenchmarkKVGetParallel/point closes the gap to within ~10% of etcd at GOMAXPROCS=6. 2. p95 latency under parallel load drops below 600 µs. 3. No bad-callback panics across 10 verbose runs (the regression test from commit d0fa396). 4. jit.off removed from M.recv/M.send/M.send_all/M.send_data.
notes Sources: docs/BENCH.md "Linux x86_64" + memory notes project_nghttp2_send_callback_rewrite, feedback_nghttp2_session_not_reentrant, feedback_nghttp2_dual_connection.
status open
priority 2
issue_type task
assignee NULL
estimated_minutes NULL
created_at 2026-05-19T13:34:42Z
created_by Eugene Blikh
owner bigbes@gmail.com
updated_at 2026-05-19T13:34:42Z
closed_at NULL
closed_by_session
external_ref NULL
spec_id
compaction_level 0
compacted_at NULL
compacted_at_commit NULL
original_size NULL
sender
ephemeral 0
wisp_type
pinned 0
is_template 0
mol_type
work_type
source_system
metadata <binary>
source_repo
close_reason
event_kind
actor
target
payload
await_type
await_id
timeout_ns 0
waiters
hook_bead
role_bead
agent_state
last_activity NULL
role_type
rig
due_at NULL
defer_until NULL
no_history 0
started_at NULL
is_blocked 0
labels 1 row
issue_id tarantool-etcd-rzr
label milestone:m3-performance
dependencies 1 row
id 3d03f2f7-0c82-5553-8be5-18d691a5e3be
issue_id tarantool-etcd-rzr
type parent-child
created_at 2026-05-20T09:56:06Z
created_by Eugene Blikh
metadata <binary>
thread_id
depends_on_issue_id tarantool-etcd-95d
depends_on_wisp_id NULL
depends_on_external NULL
events 2 rows
id 335be1e1-e2fa-55d9-a88e-79e9d69f207c
issue_id tarantool-etcd-rzr
event_type label_added
actor Eugene Blikh
old_value NULL
new_value NULL
comment Added label: milestone:m3-performance
created_at 2026-05-21T14:37:07Z
id 5e421827-73f1-5def-925a-ca6d31a77d45
issue_id tarantool-etcd-rzr
event_type created
actor Eugene Blikh
old_value
new_value
comment NULL
created_at 2026-05-19T16:34:41Z