Skip to content
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

Very slow Symfony app #53

Closed
jazithedev opened this issue Apr 2, 2017 · 3 comments
Closed

Very slow Symfony app #53

jazithedev opened this issue Apr 2, 2017 · 3 comments
Labels

Comments

@jazithedev
Copy link

Hi,
I've god Symfony 3 application in Docker CE on my Windows 10 machine. Loading time of this app is about 4-5 seconds. Symfony initialization is about 600ms. I've got even opcache installed and that time is, still, HUGE!
What could be wrong? :(

@jazithedev
Copy link
Author

Lowered application loading time by half when added

services:
    php:
        volumes:
            - /var/www/symfony/vendor

@maxpou
Copy link
Owner

maxpou commented Apr 3, 2017

Hello,
This problem isn't related to this stack. But related to docker and the filesystem (see Shared Volumes Slow #188).

Unfortunately, there is no magic solutions for now
If you really want to mix Symfony, Docker and windows, you should limit the write operation between the host and the containers.

  1. Move vendors outside the containers:
"config": {
    "bin-dir": "bin",
    "vendor-dir": "../vendor"
},
<?php
// previous
$loader = require __DIR__.'/../vendor/autoload.php';
// now
$loader = require __DIR__.'/../../vendor/autoload.php';
  1. move cache+log folders
public function getCacheDir()
{
    if (in_array($this->environment, array('dev', 'test'))) {
        return '/dev/shm/application-name/cache/' .  $this->environment;
    }

    return parent::getCacheDir();
}

public function getLogDir()
{
    if (in_array($this->environment, array('dev', 'test'))) {
        return '/dev/shm/application-name/logs';
    }

    return parent::getLogDir();
}

See more about overriding dir structure (Symfony official documentation)

BTW, MacOS got the same problem: Docker for Mac #77.

Cheers

@maxpou maxpou added the question label Apr 3, 2017
@maxpou maxpou closed this as completed Apr 3, 2017
@gavinkalika
Copy link

@maxpou your new log path is on the host machine or on docker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants