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

Dev image performance is 10x slower than prod #72

Open
sobkulir opened this issue Feb 13, 2023 · 3 comments
Open

Dev image performance is 10x slower than prod #72

sobkulir opened this issue Feb 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@sobkulir
Copy link

Description

I'm new to CraftCMS and inherited a website for maintanence. As the first step, I've tried to setup a dev and prod Docker environments. However, there seems to be a ~10x performance penalty when using craftcms/nginx:7.4-dev as base image compared to craftcms/nginx:7.4. I'm setting devMode: false.

I can see two problems:

  • Everything is slower by a factor of ~10
  • Rendering _layouts/components/alerts seems to be the bottleneck

Using craftcms/nginx:7.4 (loading admin/dashboard takes under 500ms)
prod_fin_info
Using craftcms/nginx:7.4-dev (loading admin/dashboard takes under 5000ms)
dev_fin_info

Steps to reproduce

Additional info

  • Craft version: Craft Pro 3.7.63.1
  • PHP version: 7.4.33
  • Database driver & version: MySQL 8.0.32
  • Plugins & versions:
    • Control Panel CSS 2.4.0
    • Excerptify 1.0.1
    • Freeform 3.13.22.1
    • Mailchimp Subscribe 3.1.1.1
    • Navigation 1.4.31
    • Neo 2.13.16
    • Opening Hours 1.0.0
    • Redactor 2.10.11
    • Redactor Custom Styles 3.0.4
    • Redirect Manager 1.1.1
    • SS Entry Importer 1.0.3
    • Super Table 2.7.4
@sobkulir sobkulir added the bug Something isn't working label Feb 13, 2023
@thijskaspers
Copy link

Not 100% sure, but this could be because PHP opcache is disabled for the dev environment.

We use the prod Docker image for development, and set this ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=1;. It still has opcache enabled, but it checks timestamps for changes in PHP files to clear te cache. Hope that also helps in your case.

@timkelty
Copy link
Collaborator

I suspect @thijskaspers is right. It sounds like others have had luck with opcache enabled in dev, with opcache.validate_timestamps=1.

@thijskaspers any reservations about making this default for our dev image?

Related: #8

@sobkulir
Copy link
Author

sobkulir commented Feb 13, 2023

Thank you! Using prod image with ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=1 in the Dockerfile seems to work great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants