-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Performance problem on require, require_once, include php statements #493
Comments
Interesting -- are these files baked into the image (and thus part of the AUFS layering, and subject to AUFS performance characteristics on top of the host filesystem), or are they part of a volume/bind mount (and thus subject to the host filesystem performance characteristics only)? |
@tianon I tried with 1) a volume/bind mount and 2) with files created on the fly inside the container after I started it without a volume. I had the same differences between the host and container results in both cases. I also installed a fresh new debian 8 on a PC and replicated the test on the host and in the container. Same results as on the precedent host. By the way, if I compare performance for other kind of statements (i.e. using memory), the results are instead quite the same in the host and the container. For example:
This point has been also verified comparing results between the host and the container of this php benchmark. |
Update: I tried also with a very simple image containing the test files above but I have the same results on a fresh debian8 installed on a PC (performance results in the container are 10x worst than on the host). Here's the Dockerfile I used:
I don't have any other ideas. Are people correctly running PHP web applications with these PHP statements inside containers without performance problems? Are they using Debian8 as the host? |
Hi all, Here's the output of "docker info" in this case:
Please note that in this case the storage driver is different from that used with Debian 8 (overlay instead of aufs).
It's seems to me, but it sounds crazy, that these kind of PHP statements (require, require_once, include) does not work correctly in docker !!! |
+1 |
@alexmatsak can you provide |
|
This is very interesting, I wrote a PHP include test tool based on your tests. I'm not entirely sure this is anything to do with the PHP image itself - I believe it's still an issue of Docker volume mapping performance and the use of file streams. Here is the test tool: https://github.com/kducharm/phpincludetest - it includes a flag to enable memory test in addition to just the file include tests. I have Docker For Mac Edge (17.09.0-ce-mac34 19605), as well as VirtualBox running Ubuntu 16.04. With Docker For Mac, the volume mapped test is at least 10x slower than host, and building an image without volume mapping is roughly the same speed as the host. This doesn't surprise me given the performance issues plaguing Docker For Mac volumes, but is pretty bad. In Ubuntu under VirtualBox on Mac, running docker (inception...) - host/volume mapped/image all perform roughly the same as host/image on Docker For Mac. I haven't tested Ubuntu enough to know what to expect, but it looks pretty performant. I'll probably share this testing tool on docker forums, and would be good to augment it with other file I/O tests. This is only a single container test, and I've been experiencing bad performance with DB containers on Mac and Ubuntu and need to narrow it down to file I/O or some other multip[le container/volume mapping issue. Docker machine w/NFS runs way faster on Mac than Docker For Mac currently for me, which is not good. |
Anyone already tried to use cached volumes if it is any faster? |
Using HGFS or CIFS shares, the problem is exacerbated without limits proportionally with the number of My code also has lots of traits (like a huge lot of them), and it seems it might be related. Just saying this because require performance over mounted file systems in PHP might not be Docker related. Does |
I also found it really slow on php-fpm docker image, but if use the ubuntu image, apt install the php-fpm and nginx, everything works well... I dont know why php7.2-fpm-alpine
pure ubuntu image and install php manully...
|
Hi All, I used their approach and found performance improvements but can't understand what is causing this problem. |
thats interesting. And thanks for sharing the story. I think i will try that solution. The most obvious thing that is different is that they use precompiled binaries from the distribution instead of having it compiled in the docker-image like the official php image does. One other thing i noticed, Not exactly why i had these empty responses. When i tried the Neos CMS https://www.neos.io/ |
https://medium.com/@uv_d/migrating-our-php-applications-to-docker-without-sacrificing-performance-1a69d81dcafb is way interesting, thanks for the pointer. I think we need to dig more into what's going into those Debian/Ubuntu packages and figure out why our performance is so much worse, because from what I can tell, we're already doing pretty similar things so I'd love to get to the bottom of what's going on there (and the testing there appears to be pretty systematic, which is what I've been looking for to dig more into this issue). |
This comment has been minimized.
This comment has been minimized.
I did not test this case, but we are using |
I also was noticing performance issues vs debian, and installing opcache fixed the issues. I think opcache should be installed by default on these images |
Hi all,
I'm experimenting bad performance and the problem seems to be when calling require, require_once, include statements.
Here's a very simple file test.php I used to test the problem. The file simply load 3 files test1.php, test2.php and test3.php.
Files test1.php, test2.php and test3.php are as follow:
When I call test.php from the container (using the image php:7.0-apache), the response time is 10x worst than when I execute the same simple code directly from the host (same apache and same php7).
I'm using Debian 8 also for the Host and Docker Cloud for orchestration.
Here's the output of "docker info":
Containers: 51
Running: 16
Paused: 0
Stopped: 35
Images: 388
Server Version: 1.11.2-cs5
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 839
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null host weavemesh
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.789 GiB
Name: xxxxxxx
ID: 2PC2:2IGQ:KT26:O4KM:RFID:HUWW:Y2FO:LYSK:MNZR:KXKY:OPFO:G2CX
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Username: xxxxxxxxxx
Registry: https://index.docker.io/v1/
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
The text was updated successfully, but these errors were encountered: