Problem
RequestHandler.handle_device_inference_result() reads device_inference_times.json and edge_inference_times.json on every request, then writes them back after EMA updates.
Impact
- Throughput bottleneck, especially with many concurrent devices.
- Increased latency per request.
Proposed Fix
- Keep the inference time dictionaries in memory (module-level or singleton).
- Flush to disk periodically (every N updates or X seconds) with atomic writes (write to temp file then rename).
- Consider file locking if multiple processes, or consolidate to single process.
Files: src/server/communication/request_handler.py Labels: performance, P2
Problem
RequestHandler.handle_device_inference_result()readsdevice_inference_times.jsonandedge_inference_times.jsonon every request, then writes them back after EMA updates.Impact
Proposed Fix
Files:
src/server/communication/request_handler.pyLabels:performance,P2