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

Extremely slow PHPMyAdmin #732

Closed
7 tasks done
felixmosh opened this issue Oct 8, 2020 · 8 comments
Closed
7 tasks done

Extremely slow PHPMyAdmin #732

felixmosh opened this issue Oct 8, 2020 · 8 comments
Labels

Comments

@felixmosh
Copy link
Contributor

felixmosh commented Oct 8, 2020

PhpMyAdmin works extremely slow, each query takes ~2 sec.

ISSUE TYPE

  • Bug Report

Checklist

OS / ENVIRONMENT

  1. Host operating system and version: OSX
  2. (Windows) Native Docker or Docker Toolbox:
  3. Docker version: Docker version 19.03.13, build 4484c46d9d
  4. Docker Compose version: docker-compose version 1.27.4, build 40524192
  5. (Linux) Is SELinux enabled?:
  6. What git commit hash are you on?: 4b23dd6d6dad7ade702c3d80d076368f1e962864

SUMMARY

STEPS TO REPRODUCE

I'm using php 7.3 with NGINX & MySQL 8
I've enabled xdebug using

// cfg/php-ini-7.3/xdebug.ini
; ############################################################
; # Devilbox php.ini: Xdebug example
; ############################################################
;
; Information
; -----------
; * Do not edit this file (it belongs to git)
; * This file show a possible Xdebug example configuration
; * If this file is enabled, it will overwrite the current Xdebug settings
;
; How to enable?
; --------------
; * Copy this file to another file with ".ini" extension
; * Only files with ".ini" extensions will be applied by PHP
;
; PHP.ini configuration
;
[PHP]

; Xdebug
; Use these settings to enable Xdebug for PHP
; Make sure to read up on Xdebug some settings might significantly slow down requests.
; The following is just an example configuration and should be adjusted
xdebug.default_enable   = On
xdebug.profiler_enable  = On
xdebug.remote_enable    = On
xdebug.remote_autostart = On
xdebug.remote_connect_back = 0
xdebug.remote_host      = 10.254.254.254
xdebug.remote_handler   = dbgp
xdebug.remote_port      = 9000
xdebug.idekey           = PHPSTORM
xdebug.remote_log       = /var/log/php/xdebug.log

; vim: set ft=dosini:

And added custom config for mysql

//cfg/mysql-8.0/custom.ini
[mysqld]
sql_mode=ONLY_FULL_GROUP_BY

[mysqldump]
;quick

What I've tried:

  1. adding ,cached to the MOUNT_OPTIONS
  2. remove my custom config (it made phpmyadmin a bit faster, but not enough, I guess that xdebug make it a bit slower)

EXPECTED BEHAVIOUR

PhpMyAdmin should work faster

ACTUAL BEHAVIOUR

MYSQL speed is OK when accessing from my app (node & php) it is slow just in PhpMyAdmin

OTHER INFORMATION

image

Start command

$ docker-compose up bind httpd php mysql redis

File and user permissions (Linux & MacOS)

$ id
uid=501(felixm) gid=20(staff)
$ ls -la
$ ls -la data/www
@felixmosh felixmosh added the bug label Oct 8, 2020
@cytopia
Copy link
Owner

cytopia commented Oct 8, 2020

Thanks for the bug report. This however is not an issue with Devilbox itself, but with the crappy Docker implementation on MacOS(X). Issue was reported on March 2016 and is still unfixed in this very moment: https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076

The above issue has to do with mounted volume performance being really slow on MacOS(X). As phpMyAdmin consists of a huge amount of files, it is generally slow on MacOS(X).

The only solutions/workarounds I can provide (and some you will probably not favour) are listed below:

  • Setup docker-sync
  • Use Adminer (single file, way faster than phpMyAdmin)
  • Switch to Linux (docker runs natively and is damn' fast - besides, you'd be able to say something like: btw I use Arch) ;-)
  • Use a Linux VM and docker inside (should still be faster than OSX)

@felixmosh
Copy link
Contributor Author

Thanx for the quick reply.

I'm not sure how docker-sync helps with phpmyadmin

@felixmosh
Copy link
Contributor Author

felixmosh commented Oct 13, 2020

Hi @cytopia can you explain why phpmyadmin (which is a vendor file inside the PHP docker) is affected by the mac performance issue?
From what I understand, the issue should occur when using mount from host to docker, no?

BTW, I'm using the docker only for mysql & redis instances, which my Node app connects to... SO I don't need any syncing between host <-> docker

@felixmosh felixmosh reopened this Oct 13, 2020
@cytopia
Copy link
Owner

cytopia commented Oct 13, 2020

@felixmosh phpMyAdmin is not inside the PHP container. It resides in the repository and is being mounted here: https://github.com/cytopia/devilbox/blob/master/docker-compose.yml#L174

@felixmosh
Copy link
Contributor Author

felixmosh commented Oct 13, 2020

@felixmosh phpMyAdmin is not inside the PHP container. It resides in the repository and is being mounted here: https://github.com/cytopia/devilbox/blob/master/docker-compose.yml#L174

Wow, thanx for the quick answer 🙏🏼. , OK now it make sense.

Another question, Can I "build" some how the images and just run them? without the need to sync / mount?

@cytopia
Copy link
Owner

cytopia commented Oct 13, 2020

This is also possible, but requires some steps:

  1. Build PHP images and copy the whole .devilbox/ directory to /var/www/default inside the container during build [1]
  2. Build Nginx/Apache images and copy the whole .devilbox/ directory to /var/www/default inside the container during build [2]
  3. Remove this line from docker-compose.yml https://github.com/cytopia/devilbox/blob/master/docker-compose.yml#L174

[1] https://github.com/devilbox/docker-php-fpm
[2] https://github.com/devilbox/docker-apache-2.2 | https://github.com/devilbox/docker-apache-2.4 | https://github.com/devilbox/docker-nginx-mainline | https://github.com/devilbox/docker-nginx-mainline

@felixmosh
Copy link
Contributor Author

Thanx will try it.

@felixmosh
Copy link
Contributor Author

felixmosh commented Oct 14, 2020

I've tried your idea,
What I've done is:

  1. Created a Dockerfile for php (Dockerfile-php)
    It looks like:
FROM devilbox/php-fpm:7.3-work-0.112
COPY .devilbox/www /var/www/default
  1. Created a Dockerfile for nginx (Dockerfile-httpd)
    It looks like:
FROM devilbox/nginx-stable:0.33
COPY .devilbox/www /var/www/default
  1. Built both
  2. Changed the images in docker-compose.yml
  3. Remove the lines which mounts .devilbox (one for php & one for httpd)
  4. run docker-compose kill && docker-compose rm -f && docker-compose up httpd bind mysql php redis

All starts without any noticeable error.

When I navigate to localhost I see the dev panel.
When I navigate to localhost/vendor/phpmyadmin-5.0 I get the phpMyAdmin but it is still slow 🤷🏽‍♂️

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

2 participants