Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 5a1d652

Browse files
authored
Merge pull request #881 from magento/choukalos-MAGETWO-69014
Magento Optimization Guide
2 parents 6da17ca + b5d8cee commit 5a1d652

File tree

5 files changed

+437
-1
lines changed

5 files changed

+437
-1
lines changed

guides/v2.0/config-guide/prod/prod.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Current topics include:
1818

1919
* [Deployment steps]({{page.baseurl}}config-guide/prod/prod_deploy.html)
2020
* [Magento ownership and permissions in development and production]({{page.baseurl}}config-guide/prod/prod_file-sys-perms.html)
21+
* [Magento performance optimization for production deployments]({{page.baseurl}}config-guide/prod/prod_perf-optimize.html)
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
layout: default
3+
group: config-guide
4+
subgroup: Optimization
5+
title: Magento Optimization Guide
6+
menu_title: Magento Optimization Guide
7+
menu_order: 100
8+
version: 2.0
9+
github_link: config-guide/prod/prod_perf-optimize.md
10+
---
11+
12+
This topic provides instructions for optimizing the performance of your production deployment.
13+
This process should be followed by technical users responsible for stores running in production to optimize performance.
14+
15+
### Assumptions
16+
17+
* You installed Magento using [Composer][composer-install] or a [compressed archive][zip-install]
18+
* You will be using this environment to run your live production instance of Magento 2
19+
20+
### Server - Software Recommendations
21+
22+
The following is a list of recommended software for production instances in order of impact:
23+
24+
* [Varnish cache][config-varnish]
25+
* PHP 7
26+
* (Enterprise only) Use the [Solr & Solr Search Adapter][solr]
27+
* Nginx and [PHP-FPM][php-fpm]
28+
29+
For multi-server deployments or for merchants planning on scaling their business we recommend the following:
30+
31+
* [Redis][redis-session] for sessions (from 2.0.6+)
32+
* A separate Redis instance as your [default cache][redis-default-cache]
33+
* Do not use this instance for page cache
34+
35+
### Server - Composer Optimization
36+
37+
After running `setup:di:compile` to generate classes, use composer to update the autoloader.
38+
39+
Run the following [composer command][composer-dump-autoload] to generate an optimized composer class map that supports faster auto-loading.
40+
41+
composer dump-autoload -o
42+
43+
### Server - PHP Configuration
44+
45+
We recommend enabling and tuning PHP opcache for maximum performance.
46+
Edit your `opcache.ini` file to include the following:
47+
48+
opcache.enable_cli=1
49+
opcache.memory_consumption=512
50+
opcache.max_accelerated_files=100000
51+
opcache.validate_timestamps=0
52+
opcache.consistency_checks=0
53+
54+
When you fine tune the memory allocation for opcache, take into account the size of Magento's code base and all your extensions.
55+
Magento's performance team uses the values in the preceding example for testing because it provides enough space in opcache for the average number of installed extensions.
56+
57+
If you are on a low memory machine and you do not have many extensions or customizations installed, use the following settings to get a similar result:
58+
59+
opcache.memory_consumption=64
60+
opcache.max_accelerated_files=60000
61+
62+
### Server - Redis Configuration & Tuning
63+
64+
#### Sessions
65+
66+
Consider how sessions are flushed from the cache and your merchants abandoned cart strategy.
67+
68+
#### Caches
69+
70+
Estimate a memory size to fit the total number of effective skus, product pages and content pages you expect will be used.
71+
72+
### Magento - Performance Optimizations
73+
74+
Enable these performance optimizations to improve the store front responsiveness of your Magento instance.
75+
76+
77+
Go to the Admin in default of developer mode and change the following settings for store front asset optimization:
78+
79+
#### Stores -> Configuration -> Advanced -> Developer
80+
81+
| Settings Group | Setting | Value |
82+
| ------------------- | -------------------------- | ------ |
83+
| Grid Settings | Asynchronous indexing | Enable |
84+
| CSS Settings | Minify CSS Files | Yes |
85+
| Javascript Settings | Minify JavaScript Files | Yes |
86+
| Javascript Settings | Enable JavaScript Bundling | Yes |
87+
| Template Settings | Minify HTML | Yes |
88+
89+
#### Stores -> Configuration -> Sales -> Sales Emails
90+
91+
| Settings Group | Setting | Value |
92+
| ---------------- | -------------------- | ------ |
93+
| General Settings | Asynchronous Sending | Enable |
94+
95+
#### Stores -> Index Management
96+
97+
Set all indexers to "Update on Schedule" mode.
98+
99+
100+
### Production Mode
101+
102+
Switching to production mode improves store front responsiveness and prevents long initial page load times that can occur in default mode.
103+
104+
Run the following commands to switch to production mode:
105+
106+
~~~
107+
bin/magento setup:static-content:deploy
108+
bin/magento setup:di:compile
109+
bin/magento deploy:mode:set -s production
110+
bin/magento index:reindex
111+
bin/magento cache:flush
112+
~~~
113+
114+
[composer-install]: {{page.baseurl}}install-gde/prereq/integrator_install.html
115+
[zip-install]: {{page.baseurl}}install-gde/prereq/zip_install.html
116+
[config-varnish]: {{page.baseurl}}config-guide/varnish/config-varnish.html
117+
[solr]: {{page.baseurl}}config-guide/solr/solr-overview.html
118+
[php-fpm]: https://php-fpm.org/
119+
[redis-session]: {{page.baseurl}}config-guide/redis/redis-session.html
120+
[redis-default-cache]: {{page.baseurl}}config-guide/redis/redis-pg-cache.html
121+
[composer-dump-autoload]: https://getcomposer.org/doc/03-cli.md#dump-autoload
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
layout: default
3+
group: config-guide
4+
subgroup: Optimization
5+
title: Magento Optimization Guide
6+
menu_title: Magento Optimization Guide
7+
menu_order: 100
8+
version: 2.1
9+
github_link: config-guide/prod/prod_perf-optimize.md
10+
---
11+
12+
This topic provides instructions for optimizing the performance of your production deployment.
13+
This process should be followed by technical users responsible for stores running in production to optimize performance.
14+
15+
### Assumptions
16+
17+
* You installed Magento using [Composer][composer-install] or a [compressed archive][zip-install]
18+
* You will be using this environment to run your live production instance of Magento 2
19+
20+
### Server - Software Recommendations
21+
22+
The following is a list of recommended software for production instances in order of impact:
23+
24+
* [Varnish cache][config-varnish]
25+
* PHP 7
26+
* (Enterprise only) Use the [Elasticsearch & Elasticsearch Search Adapter][elasticsearch]
27+
* Nginx and [PHP-FPM][php-fpm]
28+
29+
For multi-server deployments or for merchants planning on scaling their business we recommend the following:
30+
31+
* [Redis][redis-session] for sessions (from 2.0.6+)
32+
* A separate Redis instance as your [default cache][redis-default-cache]
33+
* Do not use this instance for page cache
34+
35+
### Server - Composer Optimization
36+
37+
After running `setup:di:compile` to generate classes, use composer to update the autoloader.
38+
39+
Run the following [composer command][composer-dump-autoload] to generate an optimized composer class map that supports faster auto-loading.
40+
41+
composer dump-autoload -o
42+
43+
### Server - PHP Configuration
44+
45+
We recommend enabling and tuning PHP opcache for maximum performance.
46+
Edit your `opcache.ini` file to include the following:
47+
48+
opcache.enable_cli=1
49+
opcache.memory_consumption=512
50+
opcache.max_accelerated_files=100000
51+
opcache.validate_timestamps=0
52+
opcache.consistency_checks=0
53+
54+
When you fine tune the memory allocation for opcache, take into account the size of Magento's code base and all your extensions.
55+
Magento's performance team uses the values in the preceding example for testing because it provides enough space in opcache for the average number of installed extensions.
56+
57+
If you are on a low memory machine and you do not have many extensions or customizations installed, use the following settings to get a similar result:
58+
59+
opcache.memory_consumption=64
60+
opcache.max_accelerated_files=60000
61+
62+
### Server - Redis Configuration & Tuning
63+
64+
#### Sessions
65+
66+
Consider how sessions are flushed from the cache and your merchants abandoned cart strategy.
67+
68+
#### Caches
69+
70+
Estimate a memory size to fit the total number of effective skus, product pages and content pages you expect will be used.
71+
72+
### Magento - Performance Optimizations
73+
74+
Enable these performance optimizations to improve the store front responsiveness of your Magento instance.
75+
76+
77+
Go to the Admin in default of developer mode and change the following settings for store front asset optimization:
78+
79+
#### Stores -> Configuration -> Advanced -> Developer
80+
81+
| Settings Group | Setting | Value |
82+
| ------------------- | -------------------------- | ------ |
83+
| Grid Settings | Asynchronous indexing | Enable |
84+
| CSS Settings | Minify CSS Files | Yes |
85+
| Javascript Settings | Minify JavaScript Files | Yes |
86+
| Javascript Settings | Enable JavaScript Bundling | Yes |
87+
| Template Settings | Minify HTML | Yes |
88+
89+
#### Stores -> Configuration -> Sales -> Sales Emails
90+
91+
| Settings Group | Setting | Value |
92+
| ---------------- | -------------------- | ------ |
93+
| General Settings | Asynchronous Sending | Enable |
94+
95+
#### Stores -> Index Management
96+
97+
Set all indexers to "Update on Schedule" mode.
98+
99+
100+
### Production Mode
101+
102+
Switching to production mode improves store front responsiveness and prevents long initial page load times that can occur in default mode.
103+
104+
Run the following commands to switch to production mode:
105+
106+
~~~
107+
bin/magento setup:static-content:deploy
108+
bin/magento setup:di:compile
109+
bin/magento deploy:mode:set -s production
110+
bin/magento index:reindex
111+
bin/magento cache:flush
112+
~~~
113+
114+
[composer-install]: {{page.baseurl}}install-gde/prereq/integrator_install.html
115+
[zip-install]: {{page.baseurl}}install-gde/prereq/zip_install.html
116+
[config-varnish]: {{page.baseurl}}config-guide/varnish/config-varnish.html
117+
[elasticsearch]: {{page.baseurl}}config-guide/elasticsearch/es-overview.html
118+
[php-fpm]: https://php-fpm.org/
119+
[redis-session]: {{page.baseurl}}config-guide/redis/redis-session.html
120+
[redis-default-cache]: {{page.baseurl}}config-guide/redis/redis-pg-cache.html
121+
[composer-dump-autoload]: https://getcomposer.org/doc/03-cli.md#dump-autoload

guides/v2.2/config-guide/prod/prod.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
layout: default
3+
group: config-guide
4+
subgroup: 999_prod
5+
title: Deploy Magento to production
6+
menu_title: Deploy Magento to production
7+
menu_node: parent
8+
menu_order: 1
9+
version: 2.2
10+
github_link: config-guide/prod/prod.md
11+
---
12+
13+
We're constantly learning from our community about how to deploy Magento into production. Our current topics on the subject are basic but we'd love to hear from you to make them better.
14+
15+
If you have advice or experience to share, open an [issue](https://github.com/magento/devdocs/issues){:target=_"blank"} or [pull request](https://github.com/magento/devdocs/pulls){:target=_"blank"} in our GitHub repository. Also see our [contribution guidelines]({{page.baseurl}}contributor-guide/contributing.html).
16+
17+
Current topics include:
18+
19+
* [Deployment steps]({{page.baseurl}}config-guide/prod/prod_deploy.html)
20+
* [Magento ownership and permissions in development and production]({{page.baseurl}}config-guide/prod/prod_file-sys-perms.html)
21+
* [Magento performance optimization for production deployments]({{page.baseurl}}config-guide/prod/prod_perf-optimize.html)
22+

0 commit comments

Comments
 (0)