diff options
| author | eunhhu <[email protected]> | 2026-09-26 21:54:49 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-26 21:54:49 +0100 |
| commit | d693cc750b75b2d862614b6f79f81a311f6294ca (patch) | |
| tree | 71588161adc22f5791ce38becf1df650b92501da /benchmarks/http | |
| parent | cb23514a5a2b00f635444d0e98a429419e6a67b4 (diff) | |
| download | pure-d693cc750b75b2d862614b6f79f81a311f6294ca.tar.gz pure-d693cc750b75b2d862614b6f79f81a311f6294ca.zip | |
Lend a text state's stored extents for its view (079)
A view that shows a text state as it is (pure_module_text_state) now goes
out as the state's stored extents, as a document read does: the answer
holds the store mapping, charged to the budget, until it is sent and its
ticket released; a state with edits not yet stored is copied as before.
Documents and views share one loan path, and the extent array grows as
needed. A 1 MiB note read by 8 connections: 776-817 answers a second
copied, 1,875-1,901 lent, p50 9.2 to 3.5 ms, peak RSS 10.3 to 5.7 MiB.
The load generator learns GET /views/page.
Diffstat (limited to 'benchmarks/http')
| -rw-r--r-- | benchmarks/http/load.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/benchmarks/http/load.c b/benchmarks/http/load.c index fd074e8..fe50deb 100644 --- a/benchmarks/http/load.c +++ b/benchmarks/http/load.c @@ -2,14 +2,15 @@ /* HTTP/1.1 load for Pure's benchmarks: N connections on one epoll thread, * each sending one request at a time and measuring its latency. * - * load PORT CONNECTIONS SECONDS get|put|score|total|page KEYS [keep-alive|close] [BODY] + * load PORT CONNECTIONS SECONDS get|put|score|total|page|note KEYS [keep-alive|close] [BODY] * get: GET /objects/kI for I in [0, KEYS). * put: connection C edits its own key kC (C mod KEYS), inserting BODY bytes * at 0 with If-Match on the revision it last saw (If-None-Match: * at * first); a 412 takes the revision from the ETag and tries again. * The scoreboard app: score posts a point for kC (POST /inputs/score?points=1, * the name as the body), total reads GET /views/total and page GET - * /views/leaders?from=0&count=20. + * /views/leaders?from=0&count=20. note reads GET /views/page (a text state + * shown as it is, as in a notes app). * Prints one JSON line: requests/s, statuses, latency percentiles (µs). */ #include <arpa/inet.h> #include <errno.h> @@ -67,7 +68,7 @@ static uint64_t percentile(uint64_t total, double p) { } static int port, connections_count, keys; -static enum { GET, PUT, SCORE, TOTAL, PAGE } method; +static enum { GET, PUT, SCORE, TOTAL, PAGE, NOTE } method; static bool put, keep_alive; static char *body; static size_t body_bytes; @@ -82,7 +83,7 @@ static void prepare(Connection *c) { snprintf(c->request, sizeof(c->request), "POST /inputs/score?points=1 HTTP/1.1\r\nHost: localhost\r\n" "Content-Length: %d\r\n%s\r\n%s", length, closing, name) : snprintf(c->request, sizeof(c->request), "GET /views/%s HTTP/1.1\r\nHost: localhost\r\n%s\r\n", - method == TOTAL ? "total" : "leaders?from=0&count=20", closing)); + method == TOTAL ? "total" : method == NOTE ? "page" : "leaders?from=0&count=20", closing)); c->sent = c->received = c->body_sent = c->body_size = 0; c->started = now_us(); return; @@ -140,15 +141,15 @@ static bool complete(Connection *c, int *status, bool *closing, size_t *length) int main(int argc, char **argv) { if (argc < 6) { - fputs("load PORT CONNECTIONS SECONDS get|put|score|total|page KEYS [keep-alive|close] [BODY]\n", stderr); + fputs("load PORT CONNECTIONS SECONDS get|put|score|total|page|note KEYS [keep-alive|close] [BODY]\n", stderr); return 2; } port = atoi(argv[1]); connections_count = atoi(argv[2]); double seconds = atof(argv[3]); - static const char *const methods[] = {"get", "put", "score", "total", "page"}; - for (method = GET; method <= PAGE && strcmp(argv[4], methods[method]); ++method) {} - if (method > PAGE) { fprintf(stderr, "load: unknown method %s\n", argv[4]); return 2; } + static const char *const methods[] = {"get", "put", "score", "total", "page", "note"}; + for (method = GET; method <= NOTE && strcmp(argv[4], methods[method]); ++method) {} + if (method > NOTE) { fprintf(stderr, "load: unknown method %s\n", argv[4]); return 2; } put = method == PUT; keys = atoi(argv[5]); keep_alive = argc > 6 && !strcmp(argv[6], "keep-alive"); |
