laravel 5.1 做的网站,没什么业务逻辑,感觉很慢啊!
这个问题已被关闭,原因:无法获得确切结果的问题
回复内容:
laravel 5.1 做的网站,没什么业务逻辑,感觉很慢啊!
应该从这几个方面入手去考虑问题
-
网页加载内容包含
服务器主文件(你请求的url地址)
这个文件的加载关系到服务器性能, 也就是包含框架的性能, 服务器性能/反应速度, 数据库的读取速度(mysql优化, 数据库查询), 网络, dns解析速度服务器资源文件(通过主url地址加载的css,js,图片,css用到的图片,字体文件等)
这个是资源文件, 一般和服务器性能没有太直接的关系, 是将资源文件直接加载到你的机器上, 没有经过任何php 的处理, 这个慢不能归咎到php 身上.这个和 IO, 网络, 服务器响应是有关系
关于第一个服务器主文件的加载速度分为以下几个部分解析, 我们打开谷歌的network调试分析下, 这个是我本机的速度 laravel 5.1.35 , 未做任何缓存(optmize,route cache)
这里的内容包含详细见 understanding resource timing
连接初始部分: 客户端队列/客户端延迟/代理请求初始
服务器响应部分:请求发送/ ttfb(服务器等待)/ 内容下载
我们看到的这里的ttfb 便是我们服务器的响应速度, 里边包含
服务器对PHP的处理(php处理/解析速度)
php处理过程中对文件的io加载(磁盘读取速度)
框架解析速度
你提的问题应该是第二个步骤的第三个小问题, 框架解析速度, 其中对框架的解析可以有以下几个优化方式
优化命令
<code>php artisan route:cache # 路由缓存 php artisan optmize --force # 程序加载优化</code>
优化对比:
优化前:
优化后:
希望答疑
业务逻辑是自己写的呀,laravel只一个豪华的房子,装修要靠自己。
慢的话是不是没有各种cache:
artisan config:cache
artisan route:cache
artisan optimize
composer dumpautoload
。。。
网站的瓶颈在io,php性能问题基本可以忽略。
网站的瓶颈在io,php性能问题基本可以忽略。
网站的瓶颈在io,php性能问题基本可以忽略。
换了nodejs就快了
from http://www.hostingadvice.com/blog/comparing-node-js-vs-php-performance/
但是写业务逻辑的时候,又该抱怨开发效率慢了
慢,你要去定位“慢”在哪里,性能瓶颈是什么。
可能是前端渲染慢
可能是网络慢
可能是你的服务器慢
可能是你的程序有问题
可能是你的SQL慢
可能是你系统设计的问题
可能是你的数据库慢
可能是你的服务器磁盘渣
不要慢就把责任怪到PHP上面。
支持 @jock 一般慢都不是因为框架,而是自己不会使用,框架能开放出来,一般都是经过N多次的修改与维护了
不知道你说的是哪里慢,问题都没说清楚,没法帮助到你

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.