400 Commits
Author SHA1 Message Date
andrew 3b7cc2a70f Don't count_down past 0
CI / pre-commit (push) Successful in 59s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64) (push) Successful in 2m22s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64) (push) Successful in 2m57s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64) (push) Successful in 2m44s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64) (push) Successful in 3m10s
2026-07-17 21:15:23 -04:00
andrew a427278cc0 Read until EAGAIN
To prepare for EPOLLET
2026-07-17 15:39:56 -04:00
andrew 8056da856f Replace protocol_context void* with ProtocolHandle int64_t
CI / pre-commit (push) Successful in 58s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64) (push) Successful in 2m23s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64) (push) Successful in 2m59s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64) (push) Successful in 2m44s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64) (push) Successful in 3m12s
Use an opaque int64_t handle for correlating async responses instead of raw pointers. HTTP uses sequence_id as the handle and stores response data in a unique_ptr<HttpResponseContext> keyed by sequence_id.
2026-07-17 15:11:02 -04:00
andrew 0c0f154390 Rename append_message to send_response and update Connection construction docs 2026-07-17 15:11:02 -04:00
andrew addef07866 Prepare for more per io thread/epoll instance state 2026-07-17 15:11:02 -04:00
andrew 36a50dfdde Remove dead code 2026-07-17 15:11:02 -04:00
weaselbotandandrew a053b92911 Add basic Gitea Actions CI workflow (#6)
CI / pre-commit (push) Successful in 56s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64) (push) Successful in 2m24s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64) (push) Successful in 2m53s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64) (push) Successful in 2m44s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64) (push) Successful in 3m9s
Closes #5

Adds a Gitea Actions workflow that runs pre-commit checks and builds/tests the project on clang and gcc for both amd64 and arm64.

weaseljson is checked out, built, and installed locally because weaseldb depends on it via `find_package(weaseljson REQUIRED)`.

Also switches the llhttp FetchContent declaration from a tarball URL to a git repository pinned to the same release commit. The tarball redirect goes through codeload.github.com, which can be blocked in restricted network environments; using git keeps the fetch on github.com.

Reviewed-on: #6
Co-authored-by: Weaselbot <weaselbot@weaselab.dev>
Co-committed-by: Weaselbot <weaselbot@weaselab.dev>
2026-06-30 20:36:37 +00:00
andrew 6219592620 Listen on public interface for test benchmark 2026-06-26 19:03:15 -04:00
andrew edfa71ce7c Add script to reproduce threading performance report results
Adds `reproduce_threading_report.sh` to run the WeaselDB server and
load tester configuration described in `threading_performance_report.md`.

Improvements over the original draft:
- Validates the build directory, config file, and required binaries
  before starting, and expects to be run from the project root.
- Wraps server shutdown and log printing in an EXIT/INT/TERM trap
  so the server is always cleaned up, even if the script is
  interrupted or the load tester fails.
- Makes the `ulimit -n` increase best-effort instead of fatal.
- Uses the existing `DURATION` variable consistently in the load
  tester invocation.
- Adds a final check that the unix socket was created before
  launching the load tester.
- Uses 2 connect threads on the client, which is sufficient for
  establishing 2000 connections over the 30-second run.
2026-06-26 14:28:05 -04:00
andrew 5790603e31 Update threading performance report with reproduced numbers
The previous report claimed 1.0M req/s at 740ns serial CPU work for the /ok health check endpoint. That measurement was made with an earlier design that transferred unique ownership of connections through the pipeline.

The current server-owned connection model adds per-request synchronization overhead (mutex + WeakRef + pending response queue) that lowers the raw /ok throughput. Reproducing on an AMD Ryzen 9 7900 with the current Release build gives approximately 825k sustained req/s with the same 740ns serial CPU work.

Updated the report to reflect the reproduced numbers and added a note explaining the historical context and why the ownership model changed (to support streaming endpoints like /v1/subscribe and safer async responses).
2026-06-26 13:16:48 -04:00
andrew 273f288020 Merge pull request 'Support building on ARM with NEON histogram intrinsics' (#4) from weaselbot/weaseldb:weaselbot/issue-3 into main
Reviewed-on: #4
Reviewed-by: andrew <andrew@weaselab.dev>
2026-06-26 16:13:00 +00:00
weaselbot 14f8552906 Apply clang-format to ARM histogram code
Pre-commit's clang-format hook reformatted the AArch64 NEON histogram
bucket updates so the project style checks pass. No functional change.
2026-06-26 11:12:10 -04:00
weaselbot c71bdf13c4 Align AArch64 histogram parameter formatting with project style
Minor whitespace fix so the NEON function signature matches the existing
AVX function's indentation.
2026-06-26 11:09:08 -04:00
weaselbot a0d64afd6f Fix ARM64 assembly size directive in cpu_work.cpp
The GNU assembler expects `.size symbol, .-symbol`.  The previous
`.size spend_cpu_cycles, spend_cpu_cycles` expression is not a constant
and breaks compilation on AArch64 Linux.  Use the correct form so the
project builds on ARM64.
2026-06-26 11:08:20 -04:00
weaselbot a377772e63 Use AArch64 NEON intrinsics for histogram bucket updates
Replace the scalar ARM fallback in update_histogram_buckets with a NEON
implementation that processes two buckets per iteration, matching the
existing AVX path.  The wrapper now dispatches to the SIMD path on both
x86-64 and AArch64 and falls back to scalar code on other architectures.
2026-06-26 11:08:03 -04:00
weaselbot d7de96ef94 Support building on ARM by providing scalar histogram fallback
The metrics histogram update code unconditionally included <immintrin.h>
and used __attribute__((target("avx"))) SSE/AVX intrinsics, which only
exist on x86-64. This prevented the project from compiling on ARM64.

Guard the x86-64 SIMD implementation and the <immintrin.h> include with
an architecture check, and add a portable scalar fallback for non-x86-64
platforms (e.g., ARM64). A thin wrapper function keeps the call sites
unchanged and preserves the AVX fast path on x86-64.

Closes #3
2026-06-26 10:49:53 -04:00
andrew f458c6b249 Make pipeline policy/topology configurable 2025-11-06 15:55:27 -05:00
andrew 9f8562e30f Fix histogram thread death bug 2025-09-18 12:39:47 -04:00
andrew cb66d65479 Add a bit more precision to docs, plus philosophy 2025-09-16 00:57:20 -04:00
andrew 4d015fa3dc Make recording metrics never block 2025-09-15 23:34:30 -04:00
andrew 0659319906 Prepare for try_lock optimization
So histogram observations never block
2025-09-15 23:04:54 -04:00
andrew 6f421629aa Add comments to avoid blocking in sequence and resolve stages 2025-09-15 22:51:41 -04:00
andrew ba59a992dd Document per-connection locking strategy 2025-09-15 22:33:52 -04:00
andrew 0d76c73077 Only shut down write side for http 2025-09-15 21:42:36 -04:00
andrew 4ecbc07367 Fix flaky connection shutdown test 2025-09-15 21:39:48 -04:00
andrew 5e625197aa Fix url accumulation bug 2025-09-15 21:36:49 -04:00
andrew 5dda7353fa Add test for url accumulation bug 2025-09-15 21:36:49 -04:00
andrew 345d8e21b2 Use WaitIfUpstreamIdle 2025-09-15 20:48:12 -04:00
andrew 917066d8c0 Move thread local state into stack 2025-09-15 20:33:45 -04:00
andrew 5a88047b9f Two release threads 2025-09-15 20:09:15 -04:00
andrew 1acdc1e753 Put Arena destructor and move constructors in header 2025-09-15 17:01:38 -04:00
andrew ae0c014298 Don't clear write interest if pending_response_queue_ non empty 2025-09-15 16:35:37 -04:00
andrew e2115152c8 Add tests for shutdown vs close 2025-09-15 15:48:10 -04:00
andrew 55f6ebc02b Implement shutting down the write-side only 2025-09-15 15:39:28 -04:00
andrew 6b52c4289c Prevent queueing of messages on connection after it will be closed 2025-09-15 15:25:40 -04:00
andrew 7ee5ca2a9b Remove dead code, use proper send_ordered_response
And prepare to try to close a connection gracefully
2025-09-15 15:08:19 -04:00
andrew 9120c05847 Use spend_cpu_cycles instead of volatile loop 2025-09-15 14:07:38 -04:00
andrew 528a467518 Make test names match binary names 2025-09-15 13:06:15 -04:00
andrew a67d7a8531 Consolidate into one send_ordered_response 2025-09-15 13:01:56 -04:00
andrew 6717b70772 Remove HttpConnectionState::response_queue_mutex 2025-09-15 12:32:19 -04:00
andrew 34accb9d80 Move GetVersion to commit pipeline 2025-09-15 12:30:02 -04:00
andrew f3c3f77a24 Extract commit pipeline to its own module 2025-09-15 11:51:01 -04:00
andrew afd240dba7 Remove vestigial "round-robin" code 2025-09-15 11:22:14 -04:00
andrew 1cb7a4c301 Remove has_pending_responses_ 2025-09-15 11:10:47 -04:00
andrew 1b220d0d1c WIP 2025-09-15 10:28:17 -04:00
andrew ec2ad27e33 Add explanatory comments 2025-09-15 00:07:44 -04:00
andrew eb98e51867 We expect to get valid fds to close in ~Connection in ~Server 2025-09-15 00:07:09 -04:00
andrew 022a79bf5b Separate HttpRequestState and HttpConnectionState
Now HttpConnectionState has a queue of HttpRequestState
2025-09-14 23:49:32 -04:00
andrew fac6b8de88 Add test that shows parsing issue
It's meant to show the pipelining issue. I guess we'll solve the
newly-discovered parsing issue first.
2025-09-14 22:24:02 -04:00
andrew 1f61f91bf5 Reset connection state after finishing with it in http_handler 2025-09-14 21:16:41 -04:00