Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to make Byobu responsive on large text output

📅 2016-Apr-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ byobu, rate limiting, tmux ⬩ 📚 Archive


I use Byobu on remote computers which I have connected to using SSH. I typically use many vertical and horizontal splits and tabs. If a program in my current pane starts writing a huge amount of text to the terminal, Byobu becomes unresponsive. That is, I cannot switch panes or even kill the runaway command!


Byobu is just a wrapper on Tmux, so we need to fix this problem in Tmux. Whenever Tmux gets a trigger sequence (like newline), it modifies the pane. If it is caught in a loop of modifying the pane, it will not get a chance to process input from the user, like control sequences to switch panes or Ctrl+C.

Thankfully, Tmux has a rate limiting feature and it is active by default. We just need to tinker with its values to make our user experience more responsive.

When the rate of triggers is above a threshold, we can ask Tmux to redraw the pane instead of just modifying it. This redraw also gives it a chance to process user input at that moment. This trigger threshold is set in the c0-change-trigger configuration option. The default is 250. That is, only if the number of trigger sequences is more than 250 per millisecond, Tmux will switch to redrawing instead of modifying the pane. To make Tmux (or Byobu) responsive, we need to lower this trigger threshold.

This solves the first problem, that is you will be able to switch away from the pane where text is being vomited. But if you want to comfortably type in the other panes, you cannot. This is because the vomiting pane is being redrawn too frequently. To fix this, we need to increase the redraw interval. This is controlled by the c0-change-interval configuration option and its default value is to redraw every 100 milliseconds.

To make Tmux responsive, I added these lines to my ~/.byobu/.tmux.conf modifying the above two options:

set -g c0-change-trigger 20
set -g c0-change-interval 1000

Tried with: Byobu 5.77, Tmux 1.8 and Ubuntu 14.04

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧