Php应用程序开始与docker一起慢慢运行(Php application started working slowly with docker)

编程入门 行业动态 更新时间:2024-10-26 20:25:38
Php应用程序开始与docker一起慢慢运行(Php application started working slowly with docker)

我确信这是一个太普遍的问题。 但仍希望得到一些有用的建议。

所以我使用vagrant运行我们的php应用程序,我们使用postgres,rabbitmq和memcached。 我设置了docker环境。 这是我的docker-compose.yml

web: build: app ports: - "80:80" volumes: - /Users/ihorsamusenko/my/project:/var/www/app links: - db - rabbit - memcached db: build: postgres ports: - 5432:5432 environment: POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres rabbit: image: rabbitmq memcached: image: memcached

但是使用这样的设置应用程序开始工作比以前慢得多。 我明白我的问题可能是应用程序特定的。 但是,也许这些问题有一些常见的提示。

I am sure it is too general question. But still hope to get some helpful advice.

So I use vagrant to run our php application, we use postgres, rabbitmq and memcached. I set up docker environment. Here's my docker-compose.yml

web: build: app ports: - "80:80" volumes: - /Users/ihorsamusenko/my/project:/var/www/app links: - db - rabbit - memcached db: build: postgres ports: - 5432:5432 environment: POSTGRES_PASSWORD: postgres POSTGRES_USER: postgres rabbit: image: rabbitmq memcached: image: memcached

But with such setup application started working much slower than it used to do. I understand that probably my problem is application specific. But still, maybe there are some common tips for such problems.

最满意答案

我猜你在Windows或Mac OS X上使用VirtualBox。

造成这种情况的可能原因是VirtualBox的容量共享速度缓慢。 一些参考:

https://news.ycombinator.com/item?id=10052837 https://github.com/boot2docker/boot2docker/issues/593 https://superuser.com/questions/859149/slow-disk-performance-in-docker-container

基本上,您需要尝试其他一些共享方法(NFS,xhyve,Vagrant rsync)以获得更多本机性能。

I'm guessing you are using VirtualBox on Windows or Mac OS X.

What is likely causing this is the slow volume sharing performance of VirtualBox. Some references:

https://news.ycombinator.com/item?id=10052837 https://github.com/boot2docker/boot2docker/issues/593 https://superuser.com/questions/859149/slow-disk-performance-in-docker-container

Basically, you will need to experiment with some other sharing methods (NFS, xhyve, Vagrant rsync) to get up to more native performance.

更多推荐

本文发布于:2023-07-19 22:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1187981.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   docker   Php   application   slowly

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!