laravel 5.1 做的网站,没什么业务逻辑,感觉很慢啊!
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多次的修改与维护了
不知道你说的是哪里慢,问题都没说清楚,没法帮助到你

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

The method of handling Laravel's email failure to send verification code is to use Laravel...
