使用Blackfire进行PHP级性能优化

本文介绍了如何使用Blackfire工具对PHP应用进行性能优化。在分析Blackfire的术语和概念后,作者通过实例展示了如何应用Blackfire定位并解决性能瓶颈,如通过分页减少内存使用和加载时间。通过对优化前后的对比,证明了改进的有效性,强调了定期进行性能测试的重要性。
摘要由CSDN通过智能技术生成

This article is part of a series on building a sample application — a multi-image gallery blog — for performance benchmarking and optimizations. (View the repo here.)

本文是构建用于性能基准测试和优化的示例应用程序(一个多图像画廊博客)系列文章的一部分。 (在此处查看回购 。)



Throughout the past few months, we’ve introduced Blackfire and ways in which it can be used to detect application performance bottlenecks. In this post, we’ll apply it to our freshly started project to try and find the low-points and low-hanging fruit which we can pick to improve our app’s performance.

在过去的几个月中,我们介绍了Blackfire及其用于检测应用程序性能瓶颈的方法。 在本文中,我们将其应用于新近启动的项目,以尝试找到可以提高应用程序性能的低点和低落的果实。

If you’re using Homestead Improved (and you should be), Blackfire is already installed.

如果您正在使用Homestead Enhanced (应该如此),则已经安装了Blackfire。

While it’s useful to be introduced to Blackfire before diving into this, applying the steps in this post won’t require any prior knowledge; we’ll start from zero.

在深入探讨Blackfire很有用之前,应用本文中的步骤不需要任何先验知识; 我们将从零开始。

建立 (Setup)

The following are useful terms when evaluating graphs produced by Blackfire.

以下是评估Blackfire生成的图形时的有用术语。

  • Reference Profile: We usually need to run our first profile as a reference profile. This profile will be the performance baseline of our application. We can compare any profile with the reference, to measure the performance achievements.

    参考资料 :我们通常需要将第一个资料作为参考资料运行。 此配置文件将成为我们应用程序的性能基准。 我们可以将任何配置文件与参考进行比较,以衡量绩效。

  • Exclusive Time: The amount of time spent on a function/method to be executed, without considering the time spent for its external calls.

    独占时间 :不执行外部调用所花费的时间,花费在要执行的函数/方法上的时间。

  • Inclusive Time: The total time spent to execute a function including all the external calls.

    包含时间 :执行一个功能(包括所有外部调用)所花费的总时间。

  • Hot Paths: Hot Paths are the parts of our application that were most active during the profile. These could be the parts that consumed more memory or took more CPU time.

    热路径 :热路径是我们的应用程序中在配置文件中最活跃的部分。 这些可能是消耗更多内存或花费更多CPU时间的部分。

The first step is registering for an account at Blackfire. The account page will have the tokens and IDs which need to be

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值