89luca89 / distrobox

Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with. Mirror available at: https://gitlab.com/89luca89/distrobox
https://distrobox.it/
GNU General Public License v3.0
9.96k stars 410 forks source link

[Discussion] CPU usage question #208

Closed aaylnx closed 2 years ago

aaylnx commented 2 years ago

I'm not sure if there are some different channels to discuss Distrobox, so I'm sorry to ask the question here, but I'm trying to find out if DB constrains CPU usage in some way. I'm using DB on Fedora Silverblue and am running a WINE app in an Ubuntu container, but it seems to be a bit constrained on CPU usage. So if DB is limiting CPU resources, is there any way to tweak this? Thanks!

misobarisic commented 2 years ago

Are you using podman or docker. By default dbx doesn't pass any performance limiting flags to the container manager, except --ulimit host when using podman (which shouldn't make a difference to be honest).

Perhaps your container manager has been setup "improperly".

89luca89 commented 2 years ago

hi @aaylnx there shouldn't be CPU overhead when using podman or docker, as it's shown in this Phoronix article where Fedora host and guest go the same speed: https://www.phoronix.com/scan.php?page=news_item&px=Clear-Containers-2022

I suspect there is heavy I/O inside $HOME and that is slowing down, if you're using podman, you can check this config to see if performance improve: https://distrobox.privatedns.org/useful_tips.html#slow-creation-on-podman-and-image-size-getting-bigger-with-distrobox-create

aaylnx commented 2 years ago

I want to thank both of you for your response. As you both surmised, I'm using podman (which is provided by default in Fedora Silverblue and Kinoite). @89luca89, I'm looking forward to trying out the adjustment to ~/.config/containers/storage.conf which you link to when I get back to work in a couple of days. Given what you link to, I wouldn't be surprised if this is indeed a source of slowdown for me since the particular Windows app I'm running through WINE is heavenly database focused and therefore might be impacted by IO considerations. Thanks again to both of you. I will report back when I have a chance to try this out!

89luca89 commented 2 years ago

I want to thank both of you for your response. As you both surmised, I'm using podman (which is provided by default in Fedora Silverblue and Kinoite). @89luca89, I'm looking forward to trying out the adjustment to ~/.config/containers/storage.conf which you link to when I get back to work in a couple of days. Given what you link to, I wouldn't be surprised if this is indeed a source of slowdown for me since the particular Windows app I'm running through WINE is heavenly database focused and therefore might be impacted by IO considerations. Thanks again to both of you. I will report back when I have a chance to try this out!

If that is heavy on IO, I would suggest to place the source of IO (the db in your case) in a location which is shared with the host (so anywhere in $HOME) or in a tmpfs, like /dev/shm or /tmp. This should rule out any problem of IO slowdown

nathanchance commented 2 years ago

I suspect there is heavy I/O inside $HOME and that is slowing down, if you're using podman, you can check this config to see if performance improve: https://distrobox.privatedns.org/useful_tips.html#slow-creation-on-podman-and-image-size-getting-bigger-with-distrobox-create

This tip should probably be updated to note that if the user has a kernel newer than 5.11 (which currently supported versions of Fedora will), native overlayfs is going to offer better performance than fuse-overlayfs:

https://www.redhat.com/sysadmin/podman-rootless-overlay

podman system info should show the overlay driver and no mount program:

$ podman system info
...
store:
  configFile: /home/nathan/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/nathan/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 2
  runRoot: /run/user/1000/containers
  volumePath: /home/nathan/.local/share/containers/storage/volumes
...
89luca89 commented 2 years ago

I suspect if @aaylnx is on Silverblue/Kionite it's already using normal overlayfs, but anyway I'll update this note on the wiki page :smile:

89luca89 commented 2 years ago

@aaylnx any news on this?

89luca89 commented 2 years ago

Closing for inactivity