1.9 KiB
1.9 KiB
Active Context (As of 2025-04-23 ~08:04 UTC+8)
1. Current Focus
Refining the core benchmarking logic and ensuring accurate metric collection, particularly after implementing and debugging streaming support.
2. Recent Changes
- Fixed Stats Recording: Correctly implemented the recording of
stats.RequestResultafter each request (both streaming and non-streaming) completes within therunWorkerfunction inpkg/concurrency/manager.go. This involved moving theRecordResultcall inside the appropriate conditional blocks and using the correct field names (IsSuccess,TimeToFirstToken). - Corrected Client Initialization: Updated
cmd/benchmark/main.goto correctly initialize theclient.FastHTTPClient. Removed the flawed logic that attempted to switch client types based on thestreamingflag, recognizing thatFastHTTPClientinternally handles both streaming (usingnet/http) and non-streaming (usingfasthttp). Ensured the correct request timeout value is passed during initialization. - Lint Fixes: Addressed several lint warnings, including unused imports and tautological conditions.
3. Next Steps & Decisions
- The core functionality of running concurrent streaming requests and recording basic results (Success, Latency, TTFT) is working.
- The immediate next step is to choose which refinement to tackle next from the following options:
- Add detailed error recording to
RequestResult. - Add token statistics (e.g., average tokens/request, total tokens) to the final report.
- Improve/clarify TTFT calculation for non-streaming requests.
- Refactor
runWorkerinpkg/concurrency/manager.gofor better readability.
- Add detailed error recording to
4. Active Considerations
- Ensuring the
net/httpclient used internally for streaming has appropriate timeout settings (currently hardcoded inStreammethod). - Planning the structure and implementation of the final report generation (console and potentially HTML).