Writing

Software, technology, sysadmin war stories, and more. Feed
Monday, April 2, 2012

Lag, jitter, and user experiences

There's a fairy tale called The Princess and the Pea in which the title character can feel a pea through 20 mattresses and 20 featherbeds. As the story goes, she can pick up on the slightest imperfection in her bedding, even when it's taken to ridiculous extremes.

Sometimes, I feel that way about how I use my computers. When I started working for myself last year, I found myself trying to write code using my usual nano-in-a-terminal route on my Macbook. The overall behavior of things just didn't work for me. Maybe it was because command-tab takes me to other applications instead of other terminal windows, but I'm not sure.

It's a great little machine for other uses, but the actual GUI experience just doesn't cut it for my development work. I wound up using my trusty Linux workstation box in X as I have for many years, and now I just ssh back to the laptop to get things done. Yes, that's right, I actually push it aside, grab another keyboard, and ssh back into it. When I log in that way, things just feel right... most of the time, that is.

When I first started doing this ssh-back thing, sometimes I'd be in the middle of editing something and then it would just start feeling wrong. I couldn't really identify exactly what was going on, but it felt like the response time kept changing. Sometimes, characters and cursor movements would be presented at a steady rate, and other times it would change.

Finally, I started up ping and left it running while this was going on. It didn't show any packet loss, but what it did show me was informative and just a little disturbing. I was seeing round-trip times just under 1 millisecond most of the time, but once in a while, it would "spike" (and I use that extremely loosely) up to 4 or 5 milliseconds.

All I have are my own observations, but it sure looked like my weird feelings of annoyance while editing something would match up with a "spike" in latency between my two machines. The systems were otherwise not doing much work and I couldn't find anything else to blame. It never happened while at the console, so it had to be network-related.

Now, I should mention that while my Linux box was hard-wired, my Mac was running over a 802.11 connection of some flavor. Obviously, wireless is prone to retransmissions and other badness far more than my own closed wired network, but I didn't think it would ever add up to a noticeable effect.

I finally decided to try eliminating it the hard way. I stopped by a local nerd supply store and picked up a tiny gigabit switch and made sure it was the only thing between my Linux box and Mac while they are both sitting on my desk.

Since then, it hasn't reoccurred. While it doesn't give a true root cause of whatever was slowing things down, it's unlikely I would be able to do anything about that anyway. It's Silly Valley, and everyone around me has at least one wireless network running on every band you can think of. I should be lucky I can get anything to work in here.

The strangest part about all of this is that I apparently picked up on a difference which ping measured as ~1 ms becoming ~5 ms. I'm not even sure I believe it, but given what happened when I moved my Mac to being hard-wired, I'm short on alternative explanations.

I do know that I demand responsiveness in the things I do. If I click on mail.app and it decides to block my input to a "new message" form just because it's processing stuff in the background, I get annoyed. There is no reason for it to do something that keeps me from typing. Firefox does similar shenanigans shortly after being restarted when typing at either the location or search bars.

I mean, okay, in the C-64, Apple II and MS-DOS days, being able to type ahead to the point of filling the buffer was expected. DOS even had its own little noise to tell you when you hit it. We don't think of those systems as particularly powerful in this day and age.

But here we are in 2012, and sometimes I can get multiple sentences keyed in before my system will decide to render it as text on the screen. This is progress?

Oh, and randomly, I do not understand the Linux frame buffer. For those times when I'm out of X and running around in text mode, I want it to just behave sanely. For whatever reason, a text mode framebuffer console feels all wrong. The scrolling is always strange, and it's slow! How can this be? I now just force it to stay in good old-fashioned VGA text mode and just put up with the contorted "non-native mode" rendering my monitor uses until I can log in and start X.

When you want to get something done, a slow system is nothing but pain.

Am I the only person who demonstrates network wonkiness by logging in and holding down a key like "." to watch it scroll? I can see when it's a clean series of characters with consistent rhythm and then I can see when it gets bottled up.

I tried to report this to the network people at $web_hosting_job and they basically refused to believe it. The customer sure noticed, though!