Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad performance when running homemade OS in qemu #137

Closed
perlun opened this issue Nov 19, 2018 · 3 comments
Closed

Bad performance when running homemade OS in qemu #137

perlun opened this issue Nov 19, 2018 · 3 comments
Labels

Comments

@perlun
Copy link

perlun commented Nov 19, 2018

Hi,

Thanks for an interesting project. Trying it out since I'm looking for a way to publish the chaos operating system on the web, to make it easy for people who want to play around with it.

However, the performance is not very great in my use case which makes things less than ideal.

This is the command line I'm trying:

$ ttyd -m10 docker run -it chaosdev/chaos

(For the curious, we build a Docker image for each push to master using this Dockerfile)

When connecting from "Firefox on Windows" -> "ttyd inside a Linux VM", the experience is unfortunately quite sluggish and a bit sub-par. Typing characters on the keyboard shows a significant input lag. However, when swapping Docker container to instead use a plain debian image for example, it works great and the performance is awesome:

$ ttyd -m10 docker run -it debian

The chaos image uses a custom background, so there is a bit of painting to do for each scroll/etc, but even general typing at the command (when not very much scrolling is done in the underlying console system in the OS) is very sluggish. It's a huge difference from running the same container right in a Linux terminal - it is much more responsive.

Even the GRUB bootloader (used by chaos before the actual OS is loaded) is quite slow/lagging in terms of keyboard input, and it doesn't use any custom background or anything so maybe it's just the QEMU curses support that generates an extreme amount of terminal output that the Xterm.js layer needs to parse or...? I really don't know; any ideas would be extremely helpful here.

(Similar to #136, but perhaps a different root cause.)

Additional info: inspecting network traffic when running the app over SSH instead of ttyd

I tried running the same Docker container via ssh localhost, and the performance is noticeably better than via ttyd. Here is a tcpdump of a single keypress - 36 bytes for the keypress, and 84 bytes for the response. So the payloads do not seem to be very large; something else is likely the root cause here.

13:58:40.212733 IP6 localhost.48122 > localhost.ssh: Flags [P.], seq 108:144, ack 453, win 3636, options [nop,nop,TS val 376876817 ecr 376873028], length 36
13:58:40.212778 IP6 localhost.ssh > localhost.48122: Flags [.], ack 144, win 1430, options [nop,nop,TS val 376876817 ecr 376876817], length 0

13:58:40.258684 IP6 localhost.ssh > localhost.48122: Flags [P.], seq 453:537, ack 144, win 1430, options [nop,nop,TS val 376876863 ecr 376876817], length 84
13:58:40.258739 IP6 localhost.48122 > localhost.ssh: Flags [.], ack 537, win 3636, options [nop,nop,TS val 376876863 ecr 376876863], length 0
@tsl0922
Copy link
Owner

tsl0922 commented Dec 8, 2018

This should be an upstream issue. I've upgraded xterm.js to the 3.8.0 version, it works better on my machine, try the latest master branch again.

@perlun
Copy link
Author

perlun commented Jan 1, 2019

Thanks @tsl0922, works better now. Closing issue. 👍

@perlun perlun closed this as completed Jan 1, 2019
@perlun
Copy link
Author

perlun commented Jan 1, 2019

(For reference, the fix that helped is 4d5a099)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants