Reduce nemar-api's per-request CPU floor
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend, performance
Research direction
Start by reading the profiling results and candidate work in this issue, then trace the request paths for file redirects and route setup. Measure each candidate change before implementing it, and compare CPU costs against the stated warm request and isolate startup baselines. Done means a measured reduction in the per-request CPU floor with the production impact checked.
Written by the indexing model from the issue text.
Description
Part of #2633. Filed under the owner's decision on #2635's acceptance (2026-12-02): the per-request CPU floor gets its own issue.
Measured on 2026-12-02:
- Production, nemar-api Workers Observability, data.nemar.org, last 24 h: CPU per request mean 76.87 ms, median 24 ms, P90 212 ms. nm000229's requests (the largest single client) have a median of 6 ms.
- Local profile of the bundled Worker in workerd (step S2A of the plan): a warm file request costs about 4.2 ms of CPU (scan 1.2 ms), a repeat about 2.1 ms. A fresh isolate costs about 72 ms of module evaluation plus about 25 ms for its first request, half of which is Hono building its route matchers. Four copies of zod are 29% of module evaluation; GC is 24%.
loadVersionRows(a D1 query) runs on every file 302 and is not used there.
So the typical request carries about 18 ms above the warm floor, which isolate start-up or per-request work the profile could not reproduce may explain. The path index and per-path cache (ADR 0150) address the tail, not this floor.
Candidate work, to be measured before changing anything: dedupe zod in the bundle; defer route matcher construction; skip loadVersionRows on the file 302 path; add a per-isolate request counter to Server-Timing to measure production isolate churn.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- Avg merge
- 4h 48m
- Merged PRs (30d)
- 468
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nemarOrg/nemar-cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
testing
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
All issues in nemarOrg/nemar-cli
Similar issues
-
Codex使用可 かんたん コード
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ryuki-moro/Nicomaru#348 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day