When checkout slows down, Magento’s profiler is the first place to look.
1) Enable profiler in staging:
```
bin/magento dev:profiler:enable html
```
2) Repeat the flow and review the most expensive blocks.
What typically appears at the top:
- Unnecessary totals collectors.
- Plugins executing repeated queries.
- Layout updates recalculating blocks on every step.
Quick actions:
- Disable collectors you don’t use.
- Memoize external API calls.
- Flatten nested `after`/`around` plugins.
If total time is “OK” but CPU spikes, check observers. If total time climbs, it’s usually queries or IO.
Extra checklist that almost always helps:
- Review `\\Magento\\Checkout\\Model\\Cart` and aggressive `before/around` plugins.
- Inspect `quote` each step: if totals recalc more than once, there’s an extra plugin.
- Disable third‑party modules and re‑measure (A/B per module).
Fast debug:
```
bin/magento dev:profiler:enable html
bin/magento setup:config:set --lock-config
```
Locking config prevents accidental changes in prod while debugging.
The goal: reduce the most expensive block, not the total “by feel”.
1) Enable profiler in staging:
```
bin/magento dev:profiler:enable html
```
2) Repeat the flow and review the most expensive blocks.
What typically appears at the top:
- Unnecessary totals collectors.
- Plugins executing repeated queries.
- Layout updates recalculating blocks on every step.
Quick actions:
- Disable collectors you don’t use.
- Memoize external API calls.
- Flatten nested `after`/`around` plugins.
If total time is “OK” but CPU spikes, check observers. If total time climbs, it’s usually queries or IO.
Extra checklist that almost always helps:
- Review `\\Magento\\Checkout\\Model\\Cart` and aggressive `before/around` plugins.
- Inspect `quote` each step: if totals recalc more than once, there’s an extra plugin.
- Disable third‑party modules and re‑measure (A/B per module).
Fast debug:
```
bin/magento dev:profiler:enable html
bin/magento setup:config:set --lock-config
```
Locking config prevents accidental changes in prod while debugging.
The goal: reduce the most expensive block, not the total “by feel”.
Comments