Symfony2 app always has a 3 second wait between kernel.request and kernel.controller

I’m trying to build this symfony2 application in a docker container with PHP7 and nginx with FastCGI PM.

Every time the application executes I get this mysterious 3 seconds of unaccountable execution time between the kernel.request and the kernel.controller.

  • Some paths of cgroup of a docker container are missing
  • Tag latest not found in repository docker.io/library/centos on Redhat Enterprise Linux behind proxy server
  • connection refused for Docker development environment
  • Docker Setup with a Mysql Container for a Python App
  • docker java7 install fail
  • Docker error & Lagom conduct visualization
  • You can see the odd request timeline in this screenshot:
    enter image description here

    This application doesn’t have this behavior when I run it on my typical php5.5+apache2 config on my vagrant machine, so I’m not sure if it’s something with my PHP config or PHP7, but I’m wondering if someone has seen something like this before and has any idea what might be happening here?

    Edit here’s the docker_compose config:

    cafe:
      build: /opt/cafe
      ports: 
          - "9981:80"
      environment: 
          - "CAFE_CACHE_DIR=/tmp/cafe/cache"
          - "CAFE_LOG_DIR=/var/log/cafe"
          - "SF_ENV=local"
      volumes: 
          - /var/log/php7:/var/log/php7
          - /var/log/nginx:/var/log/nginx
    

  • How to start service in docker container at start up
  • NGINX service failure in Dockers on limiting memory and CPU usage
  • MySQL Docker container is not saving data to new image
  • Jenkins amazon-ecr plugin issue
  • docker-compose nginx volumes not mounted
  • Container exits if invoked from compose
  • 3 Solutions collect form web for “Symfony2 app always has a 3 second wait between kernel.request and kernel.controller”

    In case anyone is curious, or having the same issue, I finally found the problem and it was not what I expected. When I was setting up this project for PHP7 I couldn’t use the standard linux distro that I normally would have, I had to add all the configuration files myself.

    After painstaking analyzing my code, I found out that the exact line, that was stalling, was a place I was running get_browser() (http://php.net/manual/en/function.get-browser.php) in a kernel.controller listener. get_browser() was having a performance problem because of the browscap.ini file I used when setting up my php configuration in the container. I guess, for some reason, the browscap.ini file I used was having parsing issues or something. I changed it out with the lite_php_browscap.ini version and now it runs very very quick with no problem.

    enter image description here

    Also have been busy with Symfony performance within a box lately. The following quite recent article was the best recap I could find about it:

    http://by-examples.net/2014/12/09/symfony2-on-vagrant.html

    This is because the vendor directory of Symfony. It needs too many IO operations. And the performance of VirtualBox synced folder is very very slow the benchmark.

    You can move vendor directory outside the synced folder. Like my way below:
    This is My question.

    But, at last, I have no best solution. So, I have moved to pure linux environment to write my code now.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.