Logo

index : blog

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/blog.git/html/tests/main.jai blob: 6555d29eea30d1bdccc8ff478c7b9800d5d59ce9 [raw] [clear marker]

        
0#import "Basic";
1#import "String";
2#import "Print_Vars";
3#import "Command_Line";
4
5#load "main.h";
6#load "backend_curl.jai";
7#load "backend_socket.jai";
8
9
10/** Stress test with wrk
11
12 wrk -t12 -c400 -d30s http://127.0.0.1:8081/search?q=test+rust
13
14 t = threads c = connections d = duration
15
16 First run achieved 4,7k rps - without the server crashing.
17 But it was busy closing FDs for a few seconds.
18
19 htop -p $(pgrep search)
20
21*/
22
23main :: () {
24 ok, args, is_set := parse_arguments(Args);
25 if !ok return;
26
27 if is_set.h {
28 log(HELP);
29 return;
30 }
31
32 if is_set.curl { curl_dispatch(args, is_set); }
33 else if is_set.sock { socket_dispatch(args, is_set); }
34 else {
35 log_error("No backend set");
36 }
37
38}
39
40
41#scope_file
42
43
44HELP :: #string STR_END
45Usage: tests [q | cq] [os | stream [d]]
46
47Examples
48
49 Simple one-shot GET request
50 `tests -os get`
51
52 Simple stream test
53 `tests -stream 1`
54
55 One-Shot with predefined query
56 `tests -os get -q umlaut`
57
58 One-Shot with custom query
59 `tests -os get -cq http://localhost:8080/?ts=123`
60
61 Stream with 3.2 MB payload and dripping in msec
62 `tests -stream 3.2 -d 1600`
63
64STR_END;
65
66
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit