Forum
Shop edits slow on saving
Hi.
I've got a runway/shop build that my local (MAMP) and dev (server) are slow when editing anything to do with shop (ie. Adding/editing product, editing shipping, editing promotions etc). Clicking save can take 30seconds for the successfully edited message. Regions in pages save instantly.
Diagnostics
Perch Runway: 3.1.2, PHP: 7.2.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_blog (5.5.1), stotto_create_order (1), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4), pipit_catalog (1.1.0)
App runtimes: <?php $apps_list = array( 'perch_members', 'perch_shop', 'perch_blog', 'stotto_create_order', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/hoops78/Documents/stotto/H&G Dev/root/perch
PERCH_CORE: /Users/hoops78/Documents/stotto/H&G Dev/root/perch/core
PERCH_RESFILEPATH: /Users/hoops78/Documents/stotto/H&G Dev/root/perch/resources
Image manipulation: GD
PHP limits: Max upload 126M, Max POST 256M, Memory: 512M, Total max file upload: 126M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/hoops78/Documents/stotto/H&G Dev/root
HTTP_HOST: stotto
We have a custom app called 'stotto_create_order' which as I test I removed from the apps config... with the same slow response.
Is there anything in the below debug that sticks out as a problem?
Debug message after saving on product page
Debug Message - Perch Runway 3.1.2
[1] SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='d670051020844ff33c0c2b5fbd604744' LIMIT 1
UPDATE perch2_users SET userHash='d9d41c4224836f9babf5ff1c1c8e251d' WHERE userID='1'
[62] SELECT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[13] SELECT itemValue FROM perch2_menu_items WHERE itemType='app'
[1] SELECT * FROM perch2_shop_products WHERE productID='1116' AND productDeleted IS NULL LIMIT 1
Using template: /templates/shop/products/product.html
[1] SELECT * FROM perch2_resources WHERE resourceID='2582' LIMIT 1
[1] SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='2582' AND resourceKey='thumb'
[1] SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='2582' AND resourceTargetWidth=600 AND resourceTargetHeight=338 AND resourceCrop=1 AND resourceDensity=2
[1] SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='2582' AND resourceTargetWidth=80 AND resourceTargetHeight=80 AND resourceCrop=1 AND resourceDensity=1.6
Resizing and cropping image... (gd, w80 h80 @1x )
[1] SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='2582' AND resourceTargetWidth=400 AND resourceTargetHeight=225 AND resourceCrop=1 AND resourceDensity=1
INSERT IGNORE INTO perch2_resources(resourceApp,resourceBucket,resourceFile,resourceKey,resourceParentID,resourceType,resourceCreated,resourceInLibrary,resourceWidth,resourceHeight,resourceTargetWidth,resourceTargetHeight,resourceCrop,resourceDensity,resourceFileSize,resourceMimeType,resourceTitle) VALUES('perch_shop','default','2189web-1-w80h80@1.6x.jpg','w80h80c1@1.6x','2582','jpg','2018-08-12 15:53:54','0',80,80,'80','80','1','1.6',5040,'image/jpeg','2189web 1 w80h80@1.6x')
[1] SELECT resourceID FROM perch2_resources WHERE resourceBucket='default' AND resourceFile='2189web-1-w80h80@1.6x.jpg' LIMIT 1
[1] SELECT * FROM perch2_resources WHERE resourceID='2582' LIMIT 1
[1] SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='2582' AND resourceKey='thumb'
[1] SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='2582' AND resourceTargetWidth=600 AND resourceTargetHeight=338 AND resourceCrop=1 AND resourceDensity=2
[1] SELECT * FROM perch2_shop_brands WHERE brandID='1' AND brandDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_categories WHERE catID=96 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID='1' AND groupDeleted IS NULL LIMIT 1
Logging resources for perch_shop
DELETE FROM perch2_resource_log WHERE appID='perch_shop' AND itemFK='productID' AND itemRowID=1116
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('perch_shop','productID',1116,2582),('perch_shop','productID',1116,2583),('perch_shop','productID',1116,2584),('perch_shop','productID',1116,2585),('perch_shop','productID',1116,2586),('perch_shop','productID',1116,2582),('perch_shop','productID',1116,2583),('perch_shop','productID',1116,2584)
UPDATE perch2_shop_products SET title='Bradgate Bedroom Chest with 5 Drawers.', sku='2189', stock_level=NULL, productDynamicFields='{\"description\":{\"_flang\":\"markdown\",\"raw\":\"###About this collection\\r\\n\\r\\nA classic oak collection, the Bradgate offers a wide range of pieces to choose from. This collection boasts extra thick tops, dove tail box drawers and solid oak all with a hand waxed finish. Perfect collection for any d\\u00e9cor.\",\"processed\":\"<h3>About this collection<\\/h3>\\n<p>A classic oak collection, the Bradgate offers a wide range of pieces to choose from. This collection boasts extra thick tops, dove tail box drawers and solid oak all with a hand waxed finish. Perfect collection for any d\\u00e9cor.<\\/p>\"},\"image\":{\"assetID\":\"2582\",\"title\":\"2189web\",\"_default\":\"\\/perch\\/resources\\/2189web-1.jpg\",\"bucket\":\"default\",\"path\":\"2189web-1.jpg\",\"size\":331661,\"w\":1200,\"h\":800,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"100\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"2189web-1-thumb@2x.jpg\",\"size\":9785,\"mime\":\"image\\/jpeg\",\"assetID\":\"2583\"},\"w600h338c1@2x\":{\"w\":\"600\",\"h\":\"338\",\"target_w\":\"600\",\"target_h\":\"338\",\"crop\":\"true\",\"density\":\"2\",\"path\":\"2189web-1-w600h338@2x.jpg\",\"size\":126312,\"mime\":\"\",\"assetID\":\"2584\"},\"w80h80c1@1.6x\":{\"w\":80,\"h\":80,\"target_w\":\"80\",\"target_h\":\"80\",\"crop\":\"true\",\"density\":\"1.6\",\"path\":\"2189web-1-w80h80@1.6x.jpg\",\"size\":5040,\"mime\":\"image\\/jpeg\"},\"w400h225c1\":{\"w\":\"400\",\"h\":\"225\",\"target_w\":\"400\",\"target_h\":\"225\",\"crop\":\"true\",\"density\":\"1\",\"path\":\"2189web-1-w400h225.jpg\",\"size\":18967,\"mime\":\"\",\"assetID\":\"2586\"}}},\"images\":[{\"images\":{\"assetID\":\"2582\",\"title\":\"2189web\",\"_default\":\"\\/perch\\/resources\\/2189web-1.jpg\",\"bucket\":\"default\",\"path\":\"2189web-1.jpg\",\"size\":331661,\"w\":1200,\"h\":800,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"100\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"2189web-1-thumb@2x.jpg\",\"size\":9785,\"mime\":\"image\\/jpeg\",\"assetID\":\"2583\"},\"w600h338c1@2x\":{\"w\":\"600\",\"h\":\"338\",\"target_w\":\"600\",\"target_h\":\"338\",\"crop\":\"true\",\"density\":\"2\",\"path\":\"2189web-1-w600h338@2x.jpg\",\"size\":126312,\"mime\":\"\",\"assetID\":\"2584\"}}},\"captiontext\":null}],\"targetMemberEmail\":null,\"quote\":null,\"slug\":\"bradgate-bedroom-chest-with-5-drawers-2189\",\"code-text\":{\"_flang\":\"html\",\"raw\":\"https:\\/\\/www.youtube.com\\/embed\\/G9t6urI9BaE\",\"processed\":\"https:\\/\\/www.youtube.com\\/embed\\/G9t6urI9BaE\"},\"key\":{\"_flang\":\"markdown\",\"raw\":\"##Product Sizes\\r\\n\\r\\n**Width:** 1000mm - \\r\\n**Height:** 1095mm - \\r\\n**Depth:** 420mm\",\"processed\":\"<h2>Product Sizes<\\/h2>\\n<p><strong>Width:<\\/strong> 1000mm -\\n<strong>Height:<\\/strong> 1095mm -\\n<strong>Depth:<\\/strong> 420mm<\\/p>\"},\"status\":\"1\",\"brand\":\"1\",\"category\":[\"96\"],\"catalog_only\":\"0\",\"price\":{\"47\":\"389.00\",\"_default\":\"389.00\"},\"prepaid_amount\":{\"47\":\"\",\"_default\":\"\"},\"sale_price\":{\"47\":\"\",\"_default\":\"\"},\"trade_price\":{\"47\":\"\",\"_default\":\"\"},\"on_sale\":null,\"tax_group\":\"1\",\"stock_status\":\"0\",\"stock_location\":\"0\",\"max_in_cart\":null,\"requires_shipping\":\"1\",\"weight\":null,\"width\":null,\"height\":null,\"depth\":null}', productStockOnParent='0', productSlug='bradgate-bedroom-chest-with-5-drawers-2189', productStatus='1', productUpdated='2018-08-12 15:53:54' WHERE productID='1116'
No ids to log.
DELETE FROM perch2_shop_index WHERE itemKey='productID' AND itemID='1116'
[1] SELECT * FROM perch2_shop_brands WHERE brandID='1' AND brandDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch2_categories WHERE catID=96 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=0 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=0 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=0 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyID=0 LIMIT 1
[1] SELECT * FROM perch2_shop_tax_groups WHERE groupID='1' AND groupDeleted IS NULL LIMIT 1
INSERT INTO perch2_shop_index (itemKey, itemID, indexKey, indexValue) VALUES ('productID',1116,'description','About this collection\nA classic oak collection, the Bradgate offers a wide range of pieces to choose from. This collection boasts extra thick tops, dove tail box drawers and solid oak all with a hand waxed finish. Perfect collection for any décor.'),('productID',1116,'image','/perch/resources/2189web-1.jpg'),('productID',1116,'images.images','/perch/resources/2189web-1.jpg'),('productID',1116,'images.captiontext',''),('productID',1116,'targetMemberEmail',''),('productID',1116,'quote',''),('productID',1116,'slug','bradgate-bedroom-chest-with-5-drawers-2189'),('productID',1116,'code-text','https://www.youtube.com/embed/G9t6urI9BaE'),('productID',1116,'key','Product Sizes\nWidth: 1000mm -\nHeight: 1095mm -\nDepth: 420mm'),('productID',1116,'status','1'),('productID',1116,'brand','1'),('productID',1116,'brand.title','Stotto'),('productID',1116,'brand.slug','stotto'),('productID',1116,'brand.status','1'),('productID',1116,'brand.brandID','1'),('productID',1116,'brand.brandTitle','Stotto'),('productID',1116,'brand.brandCreated','2017-03-14 14:57:22'),('productID',1116,'brand.brandUpdated','2017-03-14 14:57:22'),('productID',1116,'brand.brandDeleted',''),('productID',1116,'_category','products/bedroom/bedroom-furniture/'),('productID',1116,'catalog_only','0'),('productID',1116,'price','389.00'),('productID',1116,'price.gbp','389.00'),('productID',1116,'prepaid_amount',''),('productID',1116,'prepaid_amount.gbp',''),('productID',1116,'sale_price',''),('productID',1116,'sale_price.gbp',''),('productID',1116,'trade_price',''),('productID',1116,'trade_price.gbp',''),('productID',1116,'on_sale',''),('productID',1116,'tax_group','1'),('productID',1116,'tax_group.groupID','1'),('productID',1116,'tax_group.groupTitle','Standard'),('productID',1116,'tax_group.groupSlug','standard'),('productID',1116,'tax_group.groupTaxRate','buyer'),('productID',1116,'tax_group.groupCreated','2017-03-14 14:50:39'),('productID',1116,'tax_group.groupUpdated',''),('productID',1116,'tax_group.groupDeleted',''),('productID',1116,'stock_status','0'),('productID',1116,'stock_location','0'),('productID',1116,'max_in_cart',''),('productID',1116,'requires_shipping','1'),('productID',1116,'weight',''),('productID',1116,'width',''),('productID',1116,'height',''),('productID',1116,'depth',''),('productID',1116,'productID','1116'),('productID',1116,'title','Bradgate Bedroom Chest with 5 Drawers.'),('productID',1116,'sku','2189'),('productID',1116,'productSlug','bradgate-bedroom-chest-with-5-drawers-2189'),('productID',1116,'stock_level',''),('productID',1116,'parentID',''),('productID',1116,'productVariantDesc',''),('productID',1116,'productOrder','1'),('productID',1116,'productHasVariants','0'),('productID',1116,'productStockOnParent','0'),('productID',1116,'productTemplate','product.html'),('productID',1116,'productCreated','2017-10-27 10:18:59'),('productID',1116,'productUpdated','2018-08-12 15:53:54'),('productID',1116,'productDeleted',''),('productID',1116,'productStatus','1'),('productID',1116,'itemID',''),('productID',1116,'itemRowID',''),('productID',1116,'_id',1116)
[1] OPTIMIZE TABLE perch2_shop_index
DELETE FROM perch2_shop_search WHERE itemKey=1116 AND itemType='product'
INSERT INTO perch2_shop_search(itemKey,itemType,searchBody) VALUES(1116,'product',' 2189 Bradgate Bedroom Chest with 5 Drawers. About this collection\nA classic oak collection, the Bradgate offers a wide range of pieces to choose from. This collection boasts extra thick tops, dove tail box drawers and solid oak all with a hand waxed finish. Perfect collection for any décor. bradgate bedroom chest with 5 drawers 2189 https://www.youtube.com/embed/G9t6urI9BaE Product Sizes\nWidth: 1000mm -\nHeight: 1095mm -\nDepth: 420mm 1 1 Stotto stotto 1 1 Stotto 2017-03-14 14:57:22 2017-03-14 14:57:22 Bedroom Furniture 0 1 1 Standard standard buyer 2017-03-14 14:50:39 0 0 1 ')
[1] SELECT mi.*, p.privKey FROM perch2_menu_items mi LEFT JOIN perch2_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[8] SELECT mi.*, p.privKey FROM perch2_menu_items mi LEFT JOIN perch2_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch2_menu_items WHERE itemType='app' AND itemValue='perch_shop_products' LIMIT 1
[1] SELECT mi.*, p.privKey FROM perch2_menu_items mi LEFT JOIN perch2_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch2_menu_items mi LEFT JOIN perch2_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: /addons/apps/perch_shop_products/modes/product.edit.post.php
[1] SELECT * FROM perch2_resources WHERE resourceID='2582' LIMIT 1
[1] SELECT * FROM perch2_resources WHERE resourceID='2582' LIMIT 1
[1] SELECT * FROM perch2_shop_brands WHERE 1=1 AND brandDeleted IS NULL ORDER BY brandTitle ASC
[44] SELECT * FROM perch2_categories c, perch2_category_sets s WHERE c.setID=s.setID AND s.setSlug='products' ORDER BY catTreePosition ASC
[1] SELECT * FROM perch2_categories WHERE catID=96 LIMIT 1
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch2_shop_tax_groups WHERE 1=1 AND groupDeleted IS NULL ORDER BY groupTitle ASC
Mode: product.edit
Queries: 62
Memory: 11.2806
Can you post your full diagnostics report?
Sure, here it is. I've X'ed out a few details;
You've got 95,000 rows in your shop index table, but that shouldn't necessarily be an issue if your server is properly resourced, and seems to be in proportion to your 1,300 products.
If you think that's causing the issue, it might be worth looking at what you're indexing, and perhaps not index those fields you don't need to sort or filter by.
I'm not sure I understand this bit. Which bits should I look out for?
Also, the client wants to clear all the existing products and then re-add the new ones. It might be clearing the existing products might help? Is there a way to delete the products in batch(es)? As 30secs per product is going to take a while...
By default, Runway will index all the fields in your template so that they're available to sort and filter by. That obviously gives you a lot of flexibility, but there's an overhead trade off with performance.
If you have fields you know you don't want to filter or sort by, then you can reduce the overhead by not indexing them. In the master template, add the
no-index
attribute to the tag for that field and it will no longer be indexed.Is the shop already live with orders, or is it still in development?
Thanks. Its still in development. The idea is to clear all the existing products and start adding the new ones. Is there a quick way to clear products?
Yes, I'd do that directly in the database. Make a backup to be safe, then truncate these tables to clear out the products and orders from Shop:
Thanks
I've truncated the above tables on my local version and the products are not showing in admin, but they are still there on the front end of the website. I've checked in a few browsers to make sure is not a caching issue and I can go onto the product page and even add it to the cart? Is there another table that needs truncating?
To be honest, don't worry about this. Deleting the products in the admin isn't affected by the delay, so it won't take long to delete them. There are only about 250 products and the rest are variants, so shouldn't take me long deleting them.
The
no-index="true"
worked a treat with speeding up adding new products. Thanks.