You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/README.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,3 +49,52 @@ To authenticate your API requests, include the JWT token in the `Authorization`
49
49
```
50
50
Authorization: Bearer <your_token>
51
51
```
52
+
53
+
## Data Retrieval Benchmarking
54
+
55
+
### Unit Cache Benchmarking
56
+
57
+
There is a small benchmarking script at [backend/tasks/benchmark_unit_cache.py](/Users/darrellmalone/Sync/Clients/NPDC/code/police-data-trust/backend/tasks/benchmark_unit_cache.py:1) for measuring unit-heavy endpoints.
58
+
59
+
Example using an existing token:
60
+
```bash
61
+
python3 backend/tasks/benchmark_unit_cache.py \
62
+
--base-url http://localhost:5000 \
63
+
--token "$ACCESS_TOKEN" \
64
+
--unit-id <unit-uid-1> \
65
+
--unit-id <unit-uid-2> \
66
+
--search-term "precinct 1" \
67
+
--search-term "investigations" \
68
+
--output-json /tmp/unit-cache-before.json
69
+
```
70
+
71
+
Example logging in directly:
72
+
```bash
73
+
python3 backend/tasks/benchmark_unit_cache.py \
74
+
--base-url http://localhost:5000 \
75
+
--email you@example.com \
76
+
--password "your-password" \
77
+
--unit-id <unit-uid> \
78
+
--search-term "precinct 1"
79
+
```
80
+
81
+
To compare an after-run against a saved baseline:
82
+
```bash
83
+
python3 backend/tasks/benchmark_unit_cache.py \
84
+
--base-url http://localhost:5000 \
85
+
--token "$ACCESS_TOKEN" \
86
+
--unit-id <unit-uid> \
87
+
--search-term "precinct 1" \
88
+
--compare-json /tmp/unit-cache-before.json \
89
+
--output-json /tmp/unit-cache-after.json
90
+
```
91
+
92
+
For Neo4j query-plan profiling, there is also [backend/tasks/profile_unit_cache_queries.py](/Users/darrellmalone/Sync/Clients/NPDC/code/police-data-trust/backend/tasks/profile_unit_cache_queries.py:1). It runs `PROFILE` for the current cached query shape and a legacy traversal version of the same unit-related workload, then prints DB-hit and timing deltas.
0 commit comments