Closed nettybun closed 3 months ago
This is also seen in tab-complete speed:
Ok I'm not convinced this is something podman devs can control - it may simply be the state of the art of QEMU right now for macos. I tested this in Macpine too which also uses 9p virtfs mounting:
The performance is just as slow in alpine ssh
as podman machine
.
In Macpine repo the author said SSHFS might be more efficient. https://github.com/beringresearch/macpine/issues/40#issuecomment-1328348718. Not sure. I've seen really really fast internet downloads to QEMU's disk (apk add, curl wget, etc) so that's promising. I have a feeling RSYNC'ing the changes (or syncthing?) as if I was talking to a server (yes it's 2023 haha) might be best since it'd prevent devs from mistaking the disk as "cheap"...
Feel free to close if it's unactionable. Still, this is very much an issue with using podman on macos today. I only use it for work - on my personal Linux there are no perf issues :)
I think the best solution for this would be to move to virtiofsd and perhaps native mac virtualization.
A friendly reminder that this issue had no activity for 30 days.
A friendly reminder that this issue had no activity for 30 days.
This effort is still happening. @baude Update?
Hilariously I get much better performance by using Parallels and spinning up a linux VM, then hosting Podman in there while mounting my development directory into the VM. I guess Parallels does something different to get the Mac filesystem into the VM that doesn't have the same slowness?
That's hilarious thanks for sharing! I've since given up on macOS for my work computer and moved to Linux, where the problem doesn't exist.
Maybe someday I'll convince my coworkers to try Asahi on their Macs 🤷 Thanks for the effort and good luck! Feel free to close if needed.
Haha! Yea, it looks like Parallels have their own driver that gets installed when you spin up their flavour of Ubuntu etc... The filesystem type is pfs
. So far it's been working really well and is really no different to the VM Podman uses on the Mac I guess (apart from the slowness). At some point I'll configure Podman Desktop to connect to the Parallels VM but to be fair, it's easy enough to use within the VM window anyway.
Hi, we have the same observation here for Podman on Mac (both amd64 and aarch64): bind mounts are very slow for us. Our Java process in the Docker container reads a lot of YAML configuration files, and that takes 3-10 times longer when reading from a bind mount than when the files are baked into the Docker image. This problem doesn't exist with Docker on Mac, so I guess there is hope that this can be improved :)
I compared file access times by simply reading all YAML files using cat
, issuing the following on the same folder from my host, first in zsh on the Mac host, and then via podman ssh
in the Podman machine (where the same host folder can be found below /Users/
):
Directly via zsh:
time find light-modules/ -type f -name "*.yaml" -exec cat {} >/dev/null \; 2>/dev/null
find light-modules/ -type f -name "*.yaml" -exec cat {} \; > /dev/null 2> 0.10s user 0.40s system 42% cpu 1.170 total
From within Podman machine:
[root@localhost magnolia]# time find light-modules/ -type f -name "*.yaml" -exec cat {} >/dev/null \; 2>/dev/null
real 0m1.154s
user 0m0.058s
sys 0m0.119s
I'm not entirely sure how to compare the different outputs of time
on Mac vs. Linux, but in sum that looks like 0.5s vs. 1.273s, which would be factor 2.546 slower. So just reading the same files from Podman machine (not from a container) already seems to be much slower than local host file access.
Could this be due to QEMU vs. Hyperkit with regards to how folders are shared ?
Hi @rhatdan , are there per chance any efforts under way by the Podman team to solve this problem? Tim deBoer told me in https://kubernetes.slack.com/archives/C04A0L7LUFM/p1699377715926089 that the Podman team would have a look if I comment in this issue :)
There is an effort to move to native apple hypervisor, which should switch from plan 9 file system to virtiofsd, which should improve the remote file system support.
@baude WDYT?
Linking related issues: RFE: Native Mac/Windows support #8452 : this is closed, even though seemingly it could rely on Fedora Platform Request - Apple native hypervisor #1533 and Fedora Add Platform: Native Apple Hypervisor #1548, which are in progress?
@baude the article https://www.redhat.com/sysadmin/podman-mac-machine-architecture states that Podman is built on "QEMU plus HVF acceleration: Runs a virtualized Linux distribution using native macOS virtualization", but that seems to still be in progress with Platform Request - Apple native hypervisor #1533 , and 13 out of 44 tasks done in Add Platform: Native Apple Hypervisor #1548 ?
virtiofs is now uses with podman 5.9 and applehv so it is much faster
Issue Description
For context I'm developing a Node.js app on MacOS 12.6 Monterey which is running a Podman 4.3.1 (with its QEMU VM set to
security_model=none
to allow symlinks to work since those are used everywhere in Node.js'node_modules
dependency folders). It mostly works.Unfortunately the time to stat items in the volume mount is show-stoppingly slow. For JS deps this means it's several seconds to just print a version number like
npx jest -v
since the Node ecosystem is a bunch of tiny interconnected modules on disk so it's A LOT of scanning around.I think it's stat-specifically because read/write seems fine: I tried testing read/write with
dd if=/dev/zero of=tempfile bs=1M count=1024
anddd if=tempfile of=/dev/null bs=1M count=1024
no issue 🤷Here's some perf tests showing the speed difference inside and outside of the mounted folder. Note
pwd
is/Users/Hames/Repos/SomeProject
Test 1: Real usecase with JS/Node/etc.
Setup
Normal folder /tmp
Volume mounted folder /app
Test 2: More minimal reproduction case
Setup
Normal folder /tmp
Volume mounted folder /app
Test 3: Copy from volume to normal
My laptop battery dropped 3% running this command 😶...maybe a coincidence?
45MB in 1m23s?... ???
Any pointers on how to improve disk I/O is appreciated.
Steps to reproduce the issue
Steps to reproduce the issue 1. 2. 3.
Describe the results you received
Describe the results you received
Describe the results you expected
Describe the results you expected
podman info output
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
This is a QEMU issue because the same behaviour happens in
podman machine ssh
i.e outside of a "container".