In earlier parts of our series, we covered SSH terminals, Docker integration, and storage passthrough. Today in Part 8, we share the deep network engineering required to fix terminal latency and optimize SLIRP user-mode networking in QEMU on Android.
The Symptom: Terminal Typing Lag
During initial testing, typing commands in the SSH terminal tab felt slightly delayed. Keystrokes would buffer for 100–300ms before rendering on screen.
When investigating with tcpdump and socket trace tools, we discovered the root cause:
- QEMU SLIRP User-Mode Stack: SLIRP runs entirely in user-space inside the Android process sandbox (no TAP/TUN devices without root).
- Nagle’s Algorithm & Socket Buffering: Small SSH keystroke packets (1 byte) were being delayed by socket buffering mechanisms looking to coalesce small TCP frames.
The Fix: TCP_NODELAY & Virtio-Net Tuning
To eliminate typing latency:
-
Disabling Nagle's Algorithm: Forced
TCP_NODELAYon local SSH port forwards (port 2222) and local proxy bridges. - Virtio-Net MTU Configuration: Tuned guest network interface MTU to 1500 with checksum offloading disabled to reduce guest-to-host packet fragmentation.
The result? Keystroke response times dropped from 250ms to under 15ms, delivering a desktop-grade shell experience on phone screens.
Download & Links
- 📲 Google Play: https://play.google.com/store/apps/details?id=com.ai2th.linxr
- 🐙 GitHub Releases: https://github.com/AI2TH/Linxr/releases/latest
- 💬 Google Group: https://groups.google.com/g/ai2th
Top comments (0)