There is only 1 mode in Magento 1 that has to be used in Development as well as Production.
Magento 2 made life easier for developers by offering 3 modes.
Each mode has its objective, and if used with the right stage, it helps run the store smoothly and efficiently.
Doing development in Production mode or keeping the live site on Development mode negatively affects the website performance and health.
In this quick article, we will see:
- Why should you always keep the live Magento store in Production Mode?
- How to change to Production mode?
- How to change to Prodcution mode in Breeze?
#1 Default Mode
The Default mode get active when we launched the Magento 2 site for the first time. The Default mode is when no other mode is enabled.
Default mode does not have any characteristics for anything, so you have to enable the Developer mode or Production mode for any development.
The Default mode is only present to help launch the website.
#2 Developer Mode
The Developer mode is designed for development. Therefore, if you are customizing or extending the Magento 2 default functions, you should turn on the Developer mode.
It provides multiple features that speed up the development:
- Automatically compiles codes
- Advance logging in verbose
- Advance debugging capabilities
- Static view files are not cached so changed are displayed quickly
#3 Production Mode
Production mode is intended for live websites. Once the store is ready to deploy, you should enable the Development mode.
The Production mode helps the website to load smoothly and quickly.
- Static files are stored in cache only: Production mode allows full page caching, leading to fast speed and great customer experience.
- Security: There is no symlink created for the pub/static folder. Even if someone gets the user access to the pub/static and changes the data, it will only duplicate the version of those files. Next static deployment will overwrite those files.
- Error Free Browsing: Errors are put into the file system, staying invisible for customers.
Why should you always keep the live Magento store in Production Mode?
A live Magento store should be in Production mode for efficient performance and security.
Typically Production mode is 20-30% faster than the Development mode.
- In Development mode, caching is disabled to preview the changes quickly. It reduces the website speed, as each resource is materialized from the server.
- Slow speed is fine for the development team, as they are testing and making changes. If caching is enabled, they have to run several commands to flush the cache and update the website.
- But slow loading stores are not suitable for customer experience and conversion optimization. Slow stores also impact the Magento SEO negatively, as made clear with the new Google core update – Core Web Vitals.
A live Magento store should be in Production mode in an ideal scenario. However, if development is needed, a stage should be built to customize and apply changes.
How to Change Deployment Mode?
#1 Connect SSH:
You can change the Magento mode via SSH. Simply log in to the SSH and navigate to the installation directory
Then, run the list command ‘ls’ to find the public_html directory or directory with the domain name you are seeking.
#2 Get Current Deployment Mode:
Once the SSH connection is made and you are in the Magento installation directory, find the current Magento mode.
Run this command:
php bin/magento deploy:mode:show
#3 Change Deployment Mode:
Run this command to change the mode to Production.
php bin/magento deploy:mode:set production
#4 Verify the Caching
After enabling the Production mode, we suggest verifying if the caching is enabled on your store.
You can verify the caching with the following command.
php bin/magento cache:status
If the value is shown 0, it means caching is disabled.
Run the following command to enable the caching:
php bin/magento cache:enable
All the 0 will turn into 1, which means the caching is on.
#5 Clean the Cache
After enabling the cache, clean the cache once with this command:
php bin/magento cache:clean
How to Change Deployment Mode in Breeze?
Breeze provides a terminal WEB IDE that is connected to your store. So you can make some changes to store from the browser.
You do not have to connect to SSH and SFTP. Just open the WEB IDE, go to the Terminal and run the commands.
Follow the steps:
- Login to Breeze platform
- Select the Company you like to work on
- Open the Store
- Find the Tools from the Options at left side
- Open the Web IDE
- Log In with the Username and Password
Click on the ‘Terminal’ to open the Terminal in the browser. Use the commands to make changes to the server and store.
All the commands will be the same as above.
Observe the Speed Improvements
If you have been using Development mode or Default mode, you will see the speed improvements after moving to Production mode.
As the cache will be built in a few hours, the website performance will improve further.
Got ay question or stuck at any step? Please leave your doubts in the comment section.