How to reduce TTFB (Time to First byte) of my mage

2020-08-01 07:16发布

Please help me reduce TTFB of my website (magento) which is running on VPS Dedicated Hosting with CentOS release 6.6 (Final).

Current Time To First Byte is: 19.427 seconds

3条回答
Rolldiameter
2楼-- · 2020-08-01 07:39

Few things to get you started:

  • Enable Full Page Cache in Magento
  • Upgrade PHP: 5.7 is way should be able to cut the TTFB in half, if you're stuck using a lower version try adding HHVM. Checkout http://zsuraski.blogspot.ca/ for some benchmarks.
  • Add DB cache: memcached, redis for sessions, they're a life saver.
  • Remove DB logging. Magento loves to hit the DB
  • Use nginx to server you pages over apache
  • HTTP/2: As a bonus add in SPDY (soon to be replaced with HTTP/2, so keep an eye out)
  • Varnish server can be added between nginx and your php layer.

There are many more micro optimizations. A good goal is to have the page, above the fold, render in <100ms.

查看更多
Juvenile、少年°
3楼-- · 2020-08-01 07:43

Just caches don't improve performance, they reduce hardware utilization for repeated requests.

While implementing the Will Farrell's other suggestions, you need to identify those parts of Magento code that are slow. For that, you will need to enable Magento Profiler – the built in Magento tool that lets you see what Magento is doing and on what it spends most of the page load time.

here is the details method how to enable and use Magento profiler:

http://tutorialmagento.com/how-to-reduce-time-to-first-byte-ttfb-and-speed-up-magento

查看更多
一纸荒年 Trace。
4楼-- · 2020-08-01 07:53

The main changes to be made are:

  1. Gzipping Components (compression)
  2. Optimizing Images
  3. Using a content delivery network (CDN)
  4. Minifying your JavaScript and CSS
  5. Minimize the amount of HTTP requests

Before: 3.5 to 5.5 seconds (depending on time of day)

before

After: 1.5 to 2.5 seconds (depending on time of day)

after

Reference

查看更多
登录 后发表回答