Keep provider connections alive: TLS handshake costs 4.2s and is paid twice per dictation

Đang mở
#998 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
networking, performance

Hướng nghiên cứu

No files are named; start by finding where the provider HTTP client is built for each transcription/polishing request and for the LLM channel-health check (likely a client constructed per call). Confirm connections are torn down after each dictation. Done means a pooled client with a multi-minute idle timeout, a warm-up at startup and on provider/model change, and a configurable request timeout — the issue's 4.2s cold vs 0.18s warm timings are the acceptance signal.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

On networks where the TLS handshake to the provider is slow, every dictation pays the handshake
cost twice
— once for transcription and once for LLM polishing — because connections are not
kept alive between dictations. On this machine that is the single largest latency term.

Measurements (Windows 11, OpenLess 1.3.18, BYOK OpenAI)

Two requests in a row, the second reusing the connection:

request 1: tcp connect 0.125s | TLS handshake 4.194s | total 4.410s
request 2: tcp connect 0.000s | TLS handshake 0.000s | total 0.183s

The TLS handshake alone costs ~4.2 s; a reused connection answers in 0.18 s, 24x faster.

Supporting numbers:

  • DNS resolution is fine: 259-369 ms, same as any other host. Not the bottleneck.
  • TCP connect is fine: 0.125 s.
  • chatgpt.com behaves identically (~4.1 s on first hit). The ChatGPT website feels instant only
    because the browser keeps one connection open for the whole session.
  • Upload is not the bottleneck: 300 KB takes 2.3 s warm vs 5.4 s cold. The delta is the handshake.

This looks like SNI-based traffic inspection on the ISP side. It is outside the control of the app,
but the app decides how often that cost is paid.

What it looks like in the app

Avg per segment on this machine showed 9.5 s; individual dictations 3.1-5.7 s. The channel
health check for the LLM provider reported 5292 ms. Local ASR was tried as well (Foundry Local and
sherpa-onnx, several Whisper sizes), but with a cloud provider the handshake cost is paid on every
dictation and dominates everything else.

Requests
  1. Keep provider connections alive between dictations — a connection pool with a multi-minute
    idle timeout instead of closing after each request.
  2. Warm up the connection when the app starts, and after the provider or model is changed,
    so the handshake is paid once per session instead of before each dictation.
  3. If a request timeout exists, make it configurable. With a 4 s handshake plus a long
    recording, a fixed short limit produces confusing timeout errors.
Why this is worth doing

For users behind traffic inspection this term is larger than model choice or prompt size.
Two connection settings would cut several seconds off every dictation without changing any
product behaviour.

Related: #994 (plain-text insertion mode).

Ngôn ngữ chính
Rust
Star
3.7k
Fork
349
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
100

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Open-Less/openless

Tất cả issue của Open-Less/openless

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.