0

I am using Magento 2 Enterprise version 2.1.11 hosted on AWS EC2... 2 server which uses load balancer. I am having slow login query with Admin Login and saving products to database. Everything else works normal.

Checked everything like PHP configurations, Magento settings, Redis Cache, CPU Load and its Memory usage. Everything looks good to me.

Around 350 products, 150 attributes, 3 website/store and fresh project in M2.

not sure how to debug this issue.

  • You are on enterprise, have you asked this to Magento support team? – Kalpesh Feb 16 '18 at 20:21
  • Nope because I dont know that its Magento or Server or 3rd party issue. – Abhishek Panchal Feb 16 '18 at 20:44
  • have you enabled mysql slow query log in Magento? it logs all queries that are really slow and that may tell what's the issue – Kalpesh Feb 16 '18 at 20:57
2

I have the same issue after upgrade from 2.1.10 to 2.1.11. The only thing that I've found now is a very slow Redis lib, it takes up to 99% of whole "Admin Login" action time. Make a note - not Redis service, but Redis php lib.
Code ref: Cm\RedisSession\Handler::read

Not sure about products saving, but I think it could be the same. Hope this info will be helpful.

In case I'll find the solution - I post it here.

UPDATE: I've found the solution and the reason of the problem.

Problem reason: It is Magento 2.1.11 bug (not present in 2.1.10) caused by the double calling of \Cm\RedisSession\Handler::read method that initiates locking on the first call - so, the second call should wait till "break_after" config time to get needed data from Redis.

  • The first call is happened in:

    vendor/magento/framework/Session/SessionManager.php:476

  • The second call is happened in:

    vendor/magento/framework/Session/SessionManager.php:483

"break_after" config timings:

  • For BackOffice it is: 30seconds
  • For Frontend it is: 5seconds

(you can clearly see these timings in NewRelic traces)

Solution: Fix present in "2.2-develop" branch and stable version 2.2.2: https://github.com/magento/magento2/commit/aaa60b1b72bdc189b38492bd50b0ffb23101173e#diff-b4aa30666c05e391240357a7a435a7a8

  • How did you fix it? – Abhishek Panchal Feb 22 '18 at 13:31
  • Not fixed yet, working on it. However have already found couple articles that should help: astrio.net/blog/redis-slow-session-magento (it is for Magento1 but problem looks similar) and github.com/colinmollenhour/Cm_RedisSession/issues/16 – vpodorozh Feb 23 '18 at 8:14
  • I had set disable_locking to 1 in app/etc/env.php file.. and it’s work like charm.. but still we didn’t know the consequences of that change. – Abhishek Panchal Feb 23 '18 at 13:23
  • Setting of disable_locking to 1 could cause issues with session usage - in case couple user will login in the same time, login issues could be found. So I suggest to not use this solution. – vpodorozh Feb 26 '18 at 7:46
  • Found the solution - updated comment. – vpodorozh Feb 26 '18 at 14:42
1

Can you provide more details like this is an ongoing issue or you started seeing it recently? It is a fresh build or migration from M1 to M2? How big is the catalog (products, categories)? How many attributes a product has?

  • Around 350 products, 150 attributes, 3 website and Fresh project in M2. What else you need ?? – Abhishek Panchal Feb 16 '18 at 21:19
  • Not sure if you already tried. Change the mode of index to 'Update By Schedule' and try saving the SKU to find out if indexing is the issue. Any customization around Product or integration to submit product data to 3rd party services? Any error in console during product save? Slow query log can be an option too.. – Taran Feb 16 '18 at 21:46
-3

Have you checked the log files? How many 3rd party extension you are using? Are you using catalog flat tables?

One more thing just check about the crons as well...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.