From 0da1c258b488b6ed929080571d012f63783d504e Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Wed, 18 Mar 2015 16:07:48 +0200 Subject: [PATCH 1/7] MAGETWO-35130: Fix jmeter scenario for performance toolkit --- dev/tools/performance-toolkit/benchmark.jmx | 437 ++++++++++++++------ 1 file changed, 322 insertions(+), 115 deletions(-) diff --git a/dev/tools/performance-toolkit/benchmark.jmx b/dev/tools/performance-toolkit/benchmark.jmx index 1fe4919a59eb4..7d3d7aef7fa0a 100644 --- a/dev/tools/performance-toolkit/benchmark.jmx +++ b/dev/tools/performance-toolkit/benchmark.jmx @@ -316,7 +316,7 @@ props.put("category_name", vars.get("category_name")); UTF-8 - ${base_path}catalogsearch/result/?limit=30&q=Simple + ${base_path}catalogsearch/result/index/?limit=30&q=Simple GET true false @@ -340,7 +340,7 @@ props.put("category_name", vars.get("category_name")); false simple_products_url_keys - ${base_path}(index.php/)?(simple.*)${url_suffix}" title="[Ss]imple.*" + <a class="product-item-link" href="http://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">Simple $2$ -1 @@ -386,7 +386,7 @@ props.put("category_name", vars.get("category_name")); simple_product_title - .//*[@data-ui-id='page-title']/text() + .//*[@data-ui-id='page-title-wrapper']/text() false true false @@ -471,7 +471,7 @@ productList.add(productMap); UTF-8 - ${base_path}catalogsearch/result/?limit=30&q=Configurable + ${base_path}catalogsearch/result/index/?limit=30&q=Configurable GET true false @@ -495,7 +495,7 @@ productList.add(productMap); false configurable_products_url_keys - ${base_path}(index.php/)?(configurable.*)${url_suffix}" title="[Cc]onfigurable.*" + <a class="product-item-link" href="http://${host}${base_path}(index.php/)?([^'"]+)${url_suffix}">Configurable $2$ -1 @@ -541,7 +541,7 @@ productList.add(productMap); configurable_product_title - .//*[@data-ui-id='page-title']/text() + .//*[@data-ui-id='page-title-wrapper']/text() false true false @@ -550,7 +550,7 @@ productList.add(productMap); false configurable_product_attribute_id - "spConfig":\{"attributes":\{"(\d+)" + "attributes":\{"(\d+)" $1$ 1 @@ -1401,6 +1401,26 @@ vars.put("category_name", props.get("category_name"));2 + + false + simple_product_1_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + simple_product_1_form_action + + ${think_time_delay_offset} @@ -1431,6 +1451,20 @@ vars.put("category_name", props.get("category_name"));true qty + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -1439,7 +1473,7 @@ vars.put("category_name", props.get("category_name")); http - ${base_path}checkout/cart/add + ${simple_product_1_form_action} POST true false @@ -1468,17 +1502,6 @@ vars.put("category_name", props.get("category_name"));6 - - false - count(//*[@class='cart item'])=1 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -1516,6 +1539,26 @@ vars.put("category_name", props.get("category_name"));2 + + false + simple_product_2_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + simple_product_2_form_action + + ${think_time_delay_offset} @@ -1546,6 +1589,20 @@ vars.put("category_name", props.get("category_name"));true qty + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -1554,7 +1611,7 @@ vars.put("category_name", props.get("category_name")); http - ${base_path}checkout/cart/add + ${simple_product_2_form_action} POST true false @@ -1583,17 +1640,6 @@ vars.put("category_name", props.get("category_name"));6 - - false - count(//*[@class='cart item'])=2 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -1631,6 +1677,26 @@ vars.put("category_name", props.get("category_name"));2 + + false + configurable_product_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + configurable_product_form_action + + ${think_time_delay_offset} @@ -1668,6 +1734,20 @@ vars.put("category_name", props.get("category_name"));true super_attribute[${configurable_attribute_id}] + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -1676,7 +1756,7 @@ vars.put("category_name", props.get("category_name")); http - ${base_path}checkout/cart/add + ${configurable_product_form_action} POST true false @@ -1705,17 +1785,6 @@ vars.put("category_name", props.get("category_name"));6 - - false - count(//*[@class='cart item'])=3 - false - false - true - false - true - true - - @@ -1882,6 +1951,26 @@ vars.put("category_name", props.get("category_name"));2 + + false + simple_product_1_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + simple_product_1_form_action + + ${think_time_delay_offset} @@ -1912,6 +2001,20 @@ vars.put("category_name", props.get("category_name"));true qty + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -1920,7 +2023,7 @@ vars.put("category_name", props.get("category_name")); http - ${base_path}checkout/cart/add + ${simple_product_1_form_action} POST true false @@ -1949,17 +2052,6 @@ vars.put("category_name", props.get("category_name"));6 - - false - count(//*[@class='cart item'])=1 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -1997,6 +2089,26 @@ vars.put("category_name", props.get("category_name"));2 + + false + simple_product_2_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + simple_product_2_form_action + + ${think_time_delay_offset} @@ -2027,6 +2139,20 @@ vars.put("category_name", props.get("category_name"));true qty + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -2035,7 +2161,7 @@ vars.put("category_name", props.get("category_name")); http - ${base_path}checkout/cart/add + ${simple_product_2_form_action} POST true false @@ -2064,17 +2190,6 @@ vars.put("category_name", props.get("category_name"));6 - - false - count(//*[@class='cart item'])=2 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -2112,6 +2227,26 @@ vars.put("category_name", props.get("category_name"));2 + + false + configurable_product_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + configurable_product_form_action + + ${think_time_delay_offset} @@ -2149,6 +2284,20 @@ vars.put("category_name", props.get("category_name"));true super_attribute[${configurable_attribute_id}] + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -2157,7 +2306,7 @@ vars.put("category_name", props.get("category_name")); http - ${base_path}checkout/cart/add + ${configurable_product_form_action} POST true false @@ -2186,17 +2335,6 @@ vars.put("category_name", props.get("category_name"));6 - - false - count(//*[@class='cart item'])=3 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -2932,6 +3070,26 @@ if (emailsCount < 1) { 2 + + false + simple_product_1_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + simple_product_1_form_action + + ${think_time_delay_offset} @@ -2962,6 +3120,20 @@ if (emailsCount < 1) { true qty + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -2970,7 +3142,7 @@ if (emailsCount < 1) { http - ${base_path}checkout/cart/add + ${simple_product_1_form_action} POST true false @@ -2999,17 +3171,6 @@ if (emailsCount < 1) { 6 - - false - count(//*[@class='cart item'])=1 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -3047,6 +3208,26 @@ if (emailsCount < 1) { 2 + + false + simple_product_2_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + simple_product_2_form_action + + ${think_time_delay_offset} @@ -3077,6 +3258,20 @@ if (emailsCount < 1) { true qty + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -3085,7 +3280,7 @@ if (emailsCount < 1) { http - ${base_path}checkout/cart/add + ${simple_product_2_form_action} POST true false @@ -3114,17 +3309,6 @@ if (emailsCount < 1) { 6 - - false - count(//*[@class='cart item'])=2 - false - false - true - false - true - true - - ${think_time_delay_offset} @@ -3162,6 +3346,26 @@ if (emailsCount < 1) { 2 + + false + configurable_product_form_action + <form action="([^'"]+)" method="post" id="product_addtocart_form"> + $1$ + + 1 + + + + + ^.+$ + + Assertion.response_data + false + 1 + variable + configurable_product_form_action + + ${think_time_delay_offset} @@ -3199,6 +3403,20 @@ if (emailsCount < 1) { true super_attribute[${configurable_attribute_id}] + + false + true + = + true + isAjax + + + false + true + = + true + ajax + @@ -3207,7 +3425,7 @@ if (emailsCount < 1) { http - ${base_path}checkout/cart/add + ${configurable_product_form_action} POST true false @@ -3236,17 +3454,6 @@ if (emailsCount < 1) { 6 - - false - count(//*[@class='cart item'])=3 - false - false - true - false - true - true - - ${think_time_delay_offset} From 4ec48aa8f397fb009cb41dea7976538f6c723cea Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Wed, 25 Mar 2015 20:10:38 +0200 Subject: [PATCH 2/7] MAGETWO-35466: Profile Generator Optimization --- dev/tools/performance-toolkit/generate.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dev/tools/performance-toolkit/generate.php b/dev/tools/performance-toolkit/generate.php index 43a4d61cc0962..2c1b4f7833498 100644 --- a/dev/tools/performance-toolkit/generate.php +++ b/dev/tools/performance-toolkit/generate.php @@ -41,6 +41,19 @@ echo ' |- ' . $label . ': ' . $config->getValue($configKey) . PHP_EOL; } + /** @var $config \Magento\Indexer\Model\Config */ + $config = $application->getObjectManager()->get('\Magento\Indexer\Model\Config'); + $indexerListIds = $config->getIndexers(); + $indexersState = []; + foreach ($indexerListIds as $key => $indexerId) { + /** @var $indexer \Magento\Indexer\Model\Indexer */ + $indexer = $application->getObjectManager()->create('\Magento\Indexer\Model\Indexer'); + $indexer->load($indexerId['indexer_id']); + $indexersState[$indexerId['indexer_id']] = $indexer->isScheduled(); + $indexer->setScheduled(true); + unset($indexer); + } + foreach ($application->getFixtures() as $fixture) { echo $fixture->getActionTitle() . '... '; $startTime = microtime(true); @@ -50,6 +63,14 @@ echo ' done in ' . gmdate('H:i:s', $resultTime) . PHP_EOL; } + foreach ($indexerListIds as $indexerId) { + /** @var $indexer \Magento\Indexer\Model\Indexer */ + $indexer = $application->getObjectManager()->create('\Magento\Indexer\Model\Indexer'); + $indexer->load($indexerId['indexer_id']); + $indexer->setScheduled($indexersState[$indexerId['indexer_id']]); + unset($indexer); + } + $application->reindex(); $totalEndTime = microtime(true); $totalResultTime = $totalEndTime - $totalStartTime; From b689af35b607ac2bc6485855b9107323172c5621 Mon Sep 17 00:00:00 2001 From: Volodymyr Kholoshenko Date: Thu, 26 Mar 2015 16:37:01 +0200 Subject: [PATCH 3/7] MAGETWO-33040: Deployment tool treats documentation as public assets and fails on minification attempt --- .../Code/Minifier/Adapter/Css/CssMinifier.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php index dddf0a6e4c006..e1d4d01942333 100644 --- a/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php +++ b/lib/internal/Magento/Framework/Code/Minifier/Adapter/Css/CssMinifier.php @@ -11,6 +11,11 @@ class CssMinifier implements AdapterInterface { + /** + * 'pcre.recursion_limit' value for CSSMin minification + */ + const PCRE_RECURSION_LIMIT = 1000; + /** * @var CSSmin */ @@ -32,6 +37,10 @@ public function __construct(CSSmin $cssMinifier) */ public function minify($content) { - return $this->cssMinifier->run($content); + $pcreRecursionLimit = ini_get('pcre.recursion_limit'); + ini_set('pcre.recursion_limit', self::PCRE_RECURSION_LIMIT); + $result = $this->cssMinifier->run($content); + ini_set('pcre.recursion_limit', $pcreRecursionLimit); + return $result; } } From d9f7b3631abf53f64140a3a20bf342bc49692242 Mon Sep 17 00:00:00 2001 From: Volodymyr Kholoshenko Date: Thu, 26 Mar 2015 17:21:28 +0200 Subject: [PATCH 4/7] MAGETWO-35496: Varnish config and Magento content extensions are not consolidated --- app/code/Magento/PageCache/etc/varnish3.vcl | 4 ++-- app/code/Magento/PageCache/etc/varnish4.vcl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/PageCache/etc/varnish3.vcl b/app/code/Magento/PageCache/etc/varnish3.vcl index 7fa9a30ec9ac5..0b6651fbc0cd4 100644 --- a/app/code/Magento/PageCache/etc/varnish3.vcl +++ b/app/code/Magento/PageCache/etc/varnish3.vcl @@ -54,7 +54,7 @@ sub vcl_recv { std.collect(req.http.Cookie); # static files are always cacheable. remove SSL flag and cookie - if (req.url ~ "^/(pub/)?(media|static)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico|woff|svg)$") { + if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|gz|tgz|bz2|tbz|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") { unset req.http.Https; unset req.http.Cookie; } @@ -96,7 +96,7 @@ sub vcl_fetch { # images, css and js are cacheable by default so we have to remove cookie also if (beresp.ttl > 0s && (req.request == "GET" || req.request == "HEAD")) { unset beresp.http.set-cookie; - if (req.url !~ "\.(css|js|jpg|png|gif|tiff|bmp|gz|tgz|bz2|tbz|mp3|ogg|svg|swf|woff)(\?|$)") { + if (req.url !~ "\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)(\?|$)") { set beresp.http.Pragma = "no-cache"; set beresp.http.Expires = "-1"; set beresp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0"; diff --git a/app/code/Magento/PageCache/etc/varnish4.vcl b/app/code/Magento/PageCache/etc/varnish4.vcl index 5936fcd69255d..0f3dddb893d95 100644 --- a/app/code/Magento/PageCache/etc/varnish4.vcl +++ b/app/code/Magento/PageCache/etc/varnish4.vcl @@ -47,7 +47,7 @@ sub vcl_recv { std.collect(req.http.Cookie); # static files are always cacheable. remove SSL flag and cookie - if (req.url ~ "^/(pub/)?(media|static)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico|woff|svg)$") { + if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") { unset req.http.Https; unset req.http.Cookie; } @@ -90,7 +90,7 @@ sub vcl_backend_response { # images, css and js are cacheable by default so we have to remove cookie also if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) { unset beresp.http.set-cookie; - if (bereq.url !~ "\.(css|js|jpg|png|gif|tiff|bmp|gz|tgz|bz2|tbz|mp3|ogg|svg|swf|woff)(\?|$)") { + if (bereq.url !~ "\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|gz|tgz|bz2|tbz|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)(\?|$)") { set beresp.http.Pragma = "no-cache"; set beresp.http.Expires = "-1"; set beresp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0"; From 8ec9bc95d130319781c215619cd47f129d5f72f3 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Fri, 27 Mar 2015 10:45:49 +0200 Subject: [PATCH 5/7] MAGETWO-35466: Profile Generator Optimization --- dev/tools/performance-toolkit/generate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tools/performance-toolkit/generate.php b/dev/tools/performance-toolkit/generate.php index 2c1b4f7833498..097973889fb18 100644 --- a/dev/tools/performance-toolkit/generate.php +++ b/dev/tools/performance-toolkit/generate.php @@ -42,12 +42,12 @@ } /** @var $config \Magento\Indexer\Model\Config */ - $config = $application->getObjectManager()->get('\Magento\Indexer\Model\Config'); + $config = $application->getObjectManager()->get('Magento\Indexer\Model\Config'); $indexerListIds = $config->getIndexers(); $indexersState = []; foreach ($indexerListIds as $key => $indexerId) { /** @var $indexer \Magento\Indexer\Model\Indexer */ - $indexer = $application->getObjectManager()->create('\Magento\Indexer\Model\Indexer'); + $indexer = $application->getObjectManager()->create('Magento\Indexer\Model\Indexer'); $indexer->load($indexerId['indexer_id']); $indexersState[$indexerId['indexer_id']] = $indexer->isScheduled(); $indexer->setScheduled(true); @@ -65,7 +65,7 @@ foreach ($indexerListIds as $indexerId) { /** @var $indexer \Magento\Indexer\Model\Indexer */ - $indexer = $application->getObjectManager()->create('\Magento\Indexer\Model\Indexer'); + $indexer = $application->getObjectManager()->create('Magento\Indexer\Model\Indexer'); $indexer->load($indexerId['indexer_id']); $indexer->setScheduled($indexersState[$indexerId['indexer_id']]); unset($indexer); From ce9a040ab866e4fe5c539493469d99c80d52b55e Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Fri, 27 Mar 2015 11:09:13 +0200 Subject: [PATCH 6/7] MAGETWO-35466: Profile Generator Optimization --- dev/tools/performance-toolkit/generate.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dev/tools/performance-toolkit/generate.php b/dev/tools/performance-toolkit/generate.php index 097973889fb18..861abee07ef81 100644 --- a/dev/tools/performance-toolkit/generate.php +++ b/dev/tools/performance-toolkit/generate.php @@ -44,14 +44,13 @@ /** @var $config \Magento\Indexer\Model\Config */ $config = $application->getObjectManager()->get('Magento\Indexer\Model\Config'); $indexerListIds = $config->getIndexers(); + /** @var $indexerRegistry \Magento\Indexer\Model\IndexerRegistry */ + $indexerRegistry = $application->getObjectManager()->create('Magento\Indexer\Model\IndexerRegistry'); $indexersState = []; foreach ($indexerListIds as $key => $indexerId) { - /** @var $indexer \Magento\Indexer\Model\Indexer */ - $indexer = $application->getObjectManager()->create('Magento\Indexer\Model\Indexer'); - $indexer->load($indexerId['indexer_id']); + $indexer = $indexerRegistry->get($indexerId['indexer_id']); $indexersState[$indexerId['indexer_id']] = $indexer->isScheduled(); $indexer->setScheduled(true); - unset($indexer); } foreach ($application->getFixtures() as $fixture) { @@ -65,10 +64,8 @@ foreach ($indexerListIds as $indexerId) { /** @var $indexer \Magento\Indexer\Model\Indexer */ - $indexer = $application->getObjectManager()->create('Magento\Indexer\Model\Indexer'); - $indexer->load($indexerId['indexer_id']); + $indexer = $indexerRegistry->get($indexerId['indexer_id']); $indexer->setScheduled($indexersState[$indexerId['indexer_id']]); - unset($indexer); } $application->reindex(); From e7ebcb14a94663ebdbdac9cd5c31aefed9819f6e Mon Sep 17 00:00:00 2001 From: Volodymyr Kholoshenko Date: Fri, 27 Mar 2015 14:52:50 +0200 Subject: [PATCH 7/7] MAGETWO-33040: Deployment tool treats documentation as public assets and fails on minification attempt - Add 'pcre.recursion_limit' to list of HHVM-compatible int_set() directives according to http://docs.hhvm.com/manual/en/pcre.configuration.php --- .../testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php index c3a9fe9933ee4..b7c342c1fd4ec 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php @@ -36,6 +36,7 @@ class HhvmCompatibilityTest extends \PHPUnit_Framework_TestCase 'mime_magic.magicfile', 'display_errors', 'default_socket_timeout', + 'pcre.recursion_limit', ]; public function testAllowedIniGetSetDirectives()