一个php项目,或者说是产品,从无到有,从用户少,到用户达到几万级别,甚至更多。很多时候会遇到性能的瓶颈,从项目快速开发,不注重sql语句,到sql语句优化;从无缓存,到加入缓存,缓存服务器从一台到多台等等。
现在,有时候会有些迷茫,虽然随着不断的优化,性能逐渐提升了。但是优化后提升了多少个百分点,如何去检测,如何去记录,都是个问题。
求教各位大大,感谢。
回复内容:
一个php项目,或者说是产品,从无到有,从用户少,到用户达到几万级别,甚至更多。很多时候会遇到性能的瓶颈,从项目快速开发,不注重sql语句,到sql语句优化;从无缓存,到加入缓存,缓存服务器从一台到多台等等。
现在,有时候会有些迷茫,虽然随着不断的优化,性能逐渐提升了。但是优化后提升了多少个百分点,如何去检测,如何去记录,都是个问题。
求教各位大大,感谢。
xhprof 能看到代码执行各处耗时
还有就是用benchmark 工具,是必要的
性能瓶颈主要是 io,重点关注这
可以采用 Xdebug 分析程序运行状态及用FPM 启用 slow_log
用 xhprof 看报告,然后挨个优化。
可以看看我写的几篇博客,PHP优化建议,测试工具等,可能对你有用,http://www.chenglin.name/category/php/optimization
可以从编码细则,变量/数据缓存,Opcode缓存,数据库等方面考虑。可以参考《高性能PHP应用开发》这本书,讲了从哪些方面优化,如何优化,还有一些测试工具等。
来泼冷水的,php再怎么优化性能极限也在那放着,只要不是有重大逻辑问题(例如获取个小东西循环几百下),php是不需要优化的,重点是在sql查询及cache server。
性能提升主要来自于3个方面
1.用户体验
2.逻辑
3.数据
如果是"产品"首先要把用户体验放在前面,第二是逻辑层的优化(教育程序员)
第三个是数据优化
当然前面说的都是关于技术方面的优化,比如 xdebug 啊 benchmark等检测工具进行分析..
建议楼主修改成"Web性能优化"如何?
- 前端优化 http://www.cnblogs.com/y0umer/archive/2012/02/17/2809467.html
- 服务端优化 http://www.cnblogs.com/y0umer/archive/2011/10/24/2809490.html

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment