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

zellij frequent disk write activity #3127

Open
fungos opened this issue Feb 9, 2024 · 11 comments
Open

zellij frequent disk write activity #3127

fungos opened this issue Feb 9, 2024 · 11 comments

Comments

@fungos
Copy link

fungos commented Feb 9, 2024

Basic information

zellij --version: 0.39.2

stty size:

uname -av or ver(Windows): Linux x 6.6.10-1-MANJARO #1 SMP PREEMPT_DYNAMIC x86_64 GNU/Linux

Further information

Reproduction steps, noticeable behavior, related issues, etc

2. Issues with the Zellij UI / behavior / crash

Issue description

While running in foreground or even detached, the disk activity of zellij seems to do too frequent writes on disk. I have an unusual noisy disk, and I detect what I consider bad behavior on software by the noise the disk does. After trying zellij for a few days, I noted my disk was a lot more noisy than habitual. Looking at sudo iotop I can see zellij doing lots of tiny writes too frequent which is causing my disk to spin when my computer should be idle. Other software causes this kind of writes, mostly writing sessions to disk, like firefox. But the frequency of the writes is not that elevated which keeps the noise to somewhat acceptable threshold, but zellij in comparison to these other seem to be doing something between 3-5 more writes.

Minimal reproduction

Other relevant information

@pedromfedricci
Copy link
Contributor

Zellij takes snapshots of all active sessions every 1sec (link). I guess that might be all the noise that you are seeing. Looking at the docs, there is no way to change the default interval, but you can disable it all together with session_serialization false (link) in your config. Try running Zellij with the serialization option disabled to see if that is the issue.
Another option is that there is indeed some abnormal behavior going on. Figuring it out the root cause will require some more digging. Monitor Zellij's log at /tmp/zellij-1000/zellij-log/zellij.log while running it, look out for patterns that could hint what is the problem. It is even possible that the frequent writes you are seeing are actually Zellij writing to the log file constantly.

@fungos
Copy link
Author

fungos commented Feb 14, 2024

I can confirm it is the session being serialized, maybe exposing a setting to change the frequence would be nice to have.

@shanesveller
Copy link

Configuration option sounds like a welcome step forward - for example I personally would dial it down to something more like 60sec-5min on my own systems given the opportunity. If it doesn't already, maybe also ensure that the session-quit command (Ctrl-O Q?) does one last flush of the current state to the serialized copy.

@sandorex
Copy link

I believe this is already an option serilization_interval at https://github.com/zellij-org/zellij/blob/b677ffe75fb8e518441a0bd7df02abfb8dcc4989/zellij-utils/src/input/options.rs#L153C9-L153C31
But the caveat is that its a commandline argument not parsed from config from what i can see

@cristiand391
Copy link
Contributor

From the code and this comment it seems it's available as a config var: #2946 (comment)

I've seen some other options undocumented (they aren't generated from code).

@cristiand391
Copy link
Contributor

Also, in this PR the default serialization interval changed from 1s to 60s:
#2923

@pedromfedricci
Copy link
Contributor

pedromfedricci commented Feb 19, 2024

PR #2923 (v0.39.1) introduced the serialization interval config (not documented yet) and PR #2951 (v0.39.2) changed the default interval from 1sec to 60sec for how often the layout is serialized into memory. But the background job still writes into both session-metadata.kdl and session-layout.kdl (only after its first flush in this case) files every second for all active sessions (code), regardless of what the serialization_interval value is. My reading so far is that this is indeed a bug.

@justinlovinger
Copy link

I disabled session_serialization, but I still see a consistent 4KB/s disk-write activity for every session, alongside constant CPU-usage, even when idle. I am on version 0.39.2.

@pedohorse
Copy link

4KB/s disk-write activity

For me it's 150-200 KB/s of read and around 80-100 KB/s of write. I have 3 sessions almost always running, each reads the whole config each second, and writes seemingly only it's part to it.

So far I was just hoping that kernel/fs-driver optimizes those writes somehow and it's not actually always writes to the device.

It would be very nice to have that thing configurable.

@imsnif
Copy link
Member

imsnif commented Apr 23, 2024

In addition to disabling session serialization you can now also disable writing the session metadata to disk with: disable_session_metadata true/false - note that this might cause features such as the session-manager not to work properly.

@pedohorse
Copy link

I've made a little draft PR just to illustrate one possible solution to the issue - just making the poll interval configurable

#3298

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

No branches or pull requests

8 participants