- Magento 2 Architecture Layers
- Magento 2 Application Modes
- Magento 2 Areas
- Magento 2 Request Flow
- Magento 2 Coding Standard
There are 3 modes of Magento application, i.e. default (which is the default mode after install), developer, and production.
Here is the difference between them:
default
:
- Not optimized for production
- Symlinks to static view files are published to the
pub/static
directory - Errors and exceptions are not shown to the user, as they are logged to the filesystem
- This is the default mode after install, use it if you only want to view and explore Magento. You should avoid using it in development or production environment.
developer
- Symlinks to static view files are published to the
pub/static
directory - provides verbose logging
- Enables automatic code compilation
- Enables enhance debugging
- Slowest performance
- Symlinks to static view files are published to the
production
- Errors and exception are not shown to the user, as they are logged to the filesystem
- Static view files are not materialized, as they are served from the cache only
- Automatic code file compilation is disabled, as new or updated files are not written to the filesystem
- Enabling and disabling the cache types is not possible from Magento admin
- Fastest performance
To set Magento application mode from command line, use this command:
php bin/magento deploy:mode:set:{mode}
change {mode} to default, developer or production.
and to view current application mode, use this command:
php bin/magento deploy:mode:show
or you can view it directly in array inside file app/etc/env.php, in field ‘MAGE_MODE
‘.
During development, carefully balancing developer mode with some of the cache types being enabled/disabled can provide optimal performance