Backend related performance issues can be hard to track down.
Luckily, Magento 2 comes with its own profiler to help you do this.
The built-in profiler should always be used on a Staging account since it has an impact on performance and adds debugging information to the frontend.
Below are the steps to enable the profiler and track down issues:
- Make sure your code on Staging is in sync with production
- Make sure your database on Staging is in sync with production
- Reproduce the issue on staging. To make sure you don't hit Varnish add `?no_cache=1` to the URL.
- Go to the Magento 2 directory and run:
bin/magento dev:profiler:enable html
- Hit the page where the problem persists again
- Scroll to the bottom of the page
- Find the element with the highest value in the 'Time' column
- You will now have a good indication where the most time is spent
- To disable: Go to the Magento 2 directory and run: