I am using my pi4 as a portable dev server which I ssh into from a Chromebook over my home WiFi network.

What I'm seeing is that the character latency is very high, seriously impacting my developer experience. I've tried using mosh, which helps slightly, but introduces other issues, so is not the answer.

Is there anything I can do to improve ssh/WiFi latency, or even simply diagnose where the latency is arising? Is there a possibility of connecting my Chromebook to the pi4 using USB and running a serial terminal session?

  • 1
    Post your /sys/class/net/<dev>/statistics for your WiFi controller. Likely you are losing packets due to interference or weak antennas, and retransmitting the packets results in latency. On a practical note, try getting your RPi closer to the router. – Dmitry Grigoryev Nov 28 '19 at 14:31
  • 1
    all error and dropped are 0 – pinoyyid Nov 29 '19 at 14:02

You could always just plug the pi into the USB-C port and SSH in that way.

The USB-C can be used to turn the Pi4 into an ethernet device, I've written up instructions on how to set it up here:


  • 1
    Since I power my pi4 using a USB-C cable from my Chromebook, this would be my preferred option. What do I need to do on the Chromebook for it to recognise the USB port as an Ethernet device? – pinoyyid Nov 29 '19 at 12:21
  • 1
    You shouldn't need to do anything, the Pi looks like a generic USB ethernet dongle – hardillb Nov 29 '19 at 12:23
  • 1
    cool. I'll give it a try – pinoyyid Nov 29 '19 at 12:30
  • 1
    Very interesting, thanks for the blog. But you should never use deprecated /etc/rc.local anymore. And where do you get your information? I cannot find anything about it in the Raspberry Pi4 bootloader EEPROM release notes. What EEPROM version do you use? – Ingo Nov 29 '19 at 12:35
  • 1
    @hardillb that works exactly as you predicted and the character response is excellent. Top answer! – pinoyyid Nov 29 '19 at 16:40

This answers only one part of your question. For debugging on a serial terminal session you need an USB to serial adapter cable as shown at USB to TTL to UART RS232 COM Cable module Converter. This is very inexpensive but they have very long delivery times from China. You can find also adapters from Adafruit but much more expensive.

You can also use a simple ethernet cable to connect wired to the RPi 4B.

About WiFi latency you may try to look with a network sniffer. On a terminal console you can use tcpdump.

  • 1
    many thanks. Unfortunately my chromebook does not have an ethernet connector, so I'm stuck with WiFi or something over USB, – pinoyyid Nov 29 '19 at 12:28
  • 1
    @pinoyyid OK, you can't use an ethernet cable but you can use the USB/TTL adapter, isn't it? – Ingo Nov 29 '19 at 12:39
  • 1
    I only have a single USB connector on the Chromebook and that is connected to the rpi4 to deliver power. So any direct connection would need to run over that USB. – pinoyyid Nov 29 '19 at 13:52

I've been struggling with various issues to do with ping times and latency on my Pi 4.

Essentially the ping time will spike from a norm of 2-3ms to a single 200-900ms ping every 7-10 seconds. After quite a lot of investigation I found a cure; dramatically reduce the latency of the kernel scheduler.

To try it out first run:

sudo sysctl kernel.sched_min_granularity_ns

This will print the current value (probably 2250000)


sudo sysctl -w  kernel.sched_min_granularity_ns=100000

will set it to a lower value until you reboot.

If it works for you then this will make it persist across reboots:

echo kernel.sched_min_granularity_ns = 100000 | sudo tee -a /etc/sysctl.d/local.conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.