Docker Community Forums

Share and learn in the Docker community.

Response times increased


(Gary Rutland) #1

Currently developing with Phalcon PHP and since installing Docker for Mac my response times have massively increased.

Expected behavior

Using the old Docker Toolbox set up I was getting response times at ~20ms.

Actual behavior

Since using Docker for Mac my response times have now gone up to ~100ms.
This may not seem like much for one or two requests but it’s every request which in the grand scheme of things is quite a big deal for me.

Information

I have also switched to Docker for Mac at work where we are using Zend2 and noticed the same issue there as well.


(Blubber) #2

Are you experiecing high cpu load as well? I’m having a similar problem with Python / Django, response times are 5x slower then with docker machine and I have high cpu load as well (100% on 1 core, I set my VM to 1 core.)


(Alexandre) #3

Hi @scrutters,

Would you happen to have a Dockerfile you could share with the Docker staff? Perhaps a a Hello World type of application with Phalcon PHP (but one that still exhibits the ~100ms response times).

Thanks,
Alexandre


(Gary Rutland) #4

I’m starting to wander if it’s the connection between the nginx and the fpm continers, just tried the following and the response time was ~2ms: docker run -p 80:80 nginx

My dockerfile for the fpm container is as follows:

FROM php:5-fpm

RUN apt-get update && \
    apt-get install -yq \
        build-essential \
        git \
        libmcrypt-dev

WORKDIR /tmp

RUN git clone --depth=1 git://github.com/phalcon/cphalcon.git && \
    cd cphalcon/build && \
    ./install

RUN docker-php-ext-install \
        mcrypt \
        pdo_mysql

RUN apt-get autoremove -yq && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/www/*

WORKDIR /var/www

CMD php-fpm --allow-to-run-as-root

The fpm container is then linked to the nginx container via docker compose.

Let me know if you need anymore details.

Gary


(David Sheets) #5

Hi Gary,

How are the fpm and nginx containers linked with compose? Could you post your compose file as well? Or a minimal compose file that exhibits the same problem you are seeing?

Thanks,

David


(Gary Rutland) #6

The compose file would similar to this:

nginx:
  image: nginx
  privileged: true
  ports:
    - "80:80"
  volumes:
    - .:/var/www
  links:
    - fpm
fpm:
  image: custom-image
  privileged: true
  volumes:
    - .:/var/www
  links:
    - mysql
mysql:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: password

(Gary Rutland) #7

Hi,

Is there any update on this at all?

Thanks,
Gary


(Jakeworrell) #8

I am also experiencing severe performance issues with PHP apps on Docker For Mac.

It seems to be a Volume performance issue as I find I can get a >tenfold increase in performance if I move my Composer vendor directory (which is where all of the libs and their deps live) out of the the shared Volume and into /tmp inside the container. This is far from ideal however, as we may need to make changes to our own libs while they are in place and can no longer do that if they’re not shared. And it confuses the IDE.

I’m using the standard PHP 7 w/ apache Docker image from the hub.

I am also seeing huge CPU spikes when making a request to the web server.

FWIW, I think this is very likely related to File access in mounted volumes extremely slow, CPU bound in my case at least


(Gary Rutland) #9

Agreed, it does seem to be something related to the volumes.

Is there any chance of this getting looked into?
Quite frustrating.


(Chitrank Dixit) #10

I am also facing the same issue, I have my Django container I am calling it from my host machine to request and docker is somehow not submitting the requests in time therefore I have to wait for over 100 seconds to wait for my any simple request, has anyone experience this issue with docker for mac. If yes please let me know.