php Laravel 或 Phalcon 用于高流量站点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24997988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel or Phalcon for a heavy-traffic site
提问by Noah Goodrich
I come from a Codeigniter background. I've used it for three years and really like it. It's simplicity is great.
我来自 Codeigniter 背景。我已经使用了三年,非常喜欢它。它的简单性很棒。
I've built massive sites with Codeigniter, but I'm looking for a new PHP framework to learn.
我已经使用 Codeigniter 构建了大量站点,但我正在寻找一个新的 PHP 框架来学习。
The main reason for this change is a potentially big project on the horizon. It will not have many users (perhaps 100 at most), but the outbound traffic produced by the server will be huge. The project will transmit thousands of files (ranging in size from 1mb to several hundred mb) via FTP, one after the other. It also deals with users uploading hundreds of files.
这种变化的主要原因是一个潜在的大项目即将到来。它不会有很多用户(最多可能有 100 个),但是服务器产生的出站流量将是巨大的。该项目将通过 FTP 一个接一个地传输数千个文件(大小从 1 mb 到数百 mb)。它还处理用户上传数百个文件。
The key for this project is speed. The system needs to fly through the running of the scripts (it runs a long script every time a file is sent via FTP to gather the file, it's type and it's destination) as quickly as possible to minimize performance issues. I'm aware that the transmitting of the files will only be as quick as the server can do it, and really as quick as the slowest bottleneck, but here I'm trying to minimize the bottleneck in the code as much as possible.
这个项目的关键是速度。系统需要尽快完成脚本的运行(每次通过 FTP 发送文件时它都会运行一个长脚本来收集文件、它的类型和它的目的地)以尽可能减少性能问题。我知道文件的传输只会与服务器可以做到的一样快,并且真的与最慢的瓶颈一样快,但在这里我试图尽可能地减少代码中的瓶颈。
After a bit of research, I like the look of Laravel and have installed it to get to grips with it. But it's could its speed be an issue as its been tested to be slower than Codeigniter? Will heavy traffic and a lot of PHP parsing slow down the I know that Phalcon is based on C thus making it the fastest framework, would Phalcon be the better choice?
经过一番研究,我喜欢 Laravel 的外观,并安装了它来掌握它。但它的速度可能是一个问题,因为它被测试为比 Codeigniter 慢?我知道 Phalcon 是基于 C 的,因此它是最快的框架,因此繁重的流量和大量的 PHP 解析会减慢速度,Phalcon 会是更好的选择吗?
Any thoughts are much appreciated :)
任何想法都非常感谢:)
回答by azngunit81
I am unsure if your question will be taken down as it being an opinion (you know according to guidelines and all)
我不确定你的问题是否会因为它是意见而被删除(你知道根据指南和所有)
but IMO - despite Phalcon being fast for its C build, I find (being Laravel 3 user transitioning from Codeigniter before it retired) with Laravel 4 now - it has a lot of integration with known networks and architectures.
但是 IMO - 尽管 Phalcon 的 C 构建速度很快,但我发现(Laravel 3 用户在它退休之前从 Codeigniter 过渡)现在使用 Laravel 4 - 它与已知的网络和架构有很多集成。
Not to bash Phalcon as I have very minimal usage of it but here are some bullets for Laravel:
不要抨击 Phalcon,因为我对它的使用很少,但这里有一些 Laravel 的要点:
Easily modular with composer: all packages can be imported in with the current PSR standards from composer for rapid deployment of dependencies which Codeigniter was lacking.
It can follow any style you want it to be: PSR-0 and PSR-4. It's a natural MVC but you can easily go with TDD(or BDD), and other format. Though this is a poor bullet to some but it offers a lot of flexibility on adapting to various works.
IoC is built into the APP. Its very comprehensible and extensives in order to utlize IoC
Taylor Otwell is very active in adjusting and fine tuning the framework. Its a very active thriving community (Laracon NYC just passed, next up Laracon Amsterdam), so you will not be shorted with support.
A lot of know application out there are pre-integrated with the framework from Queues (beanstalk, IronMQ) to mailers (swiftmailer), and even Cache systems (Redis or others). The interface is straight forward in terms of functions - worse case? just extend and you are ready to roll out.
Readability: a lot of the structure and how the ORM (if you choose with the native ORM of Laravel which is called Eloquent) is all about readability of your code despite the underbelly being complex. So it will scaled right (a lot of people who switched over states the same).
使用 composer 轻松模块化:所有包都可以从 composer 导入当前的 PSR 标准,以便快速部署 Codeigniter 缺乏的依赖项。
它可以遵循您想要的任何样式:PSR-0 和 PSR-4。这是一个自然的 MVC,但您可以轻松地使用 TDD(或 BDD)和其他格式。虽然这对某些人来说是一个糟糕的子弹,但它在适应各种作品方面提供了很大的灵活性。
IoC 内置于 APP 中。为了利用 IoC,它非常易于理解和广泛
Taylor Otwell 在调整和微调框架方面非常积极。它是一个非常活跃的繁荣社区(Laracon NYC 刚刚通过,接下来是 Laracon Amsterdam),因此您不会因支持而短缺。
从队列(beanstalk,IronMQ)到邮件程序(swiftmailer),甚至缓存系统(Redis 或其他),许多已知的应用程序都与框架预先集成。界面在功能方面是直截了当的 - 更糟糕的情况?只需扩展即可推出。
可读性:尽管底层很复杂,但很多结构和 ORM(如果你选择 Laravel 的原生 ORM,称为 Eloquent)都是关于代码的可读性。所以它会按比例缩放(很多切换状态的人都是一样的)。
Some further readings from those who switched over and wondered like you: http://www.web-and-development.com/laravel-vs-codeigniter/
那些像你一样切换并想知道的人的一些进一步阅读:http: //www.web-and-development.com/laravel-vs-codeigniter/
and http://mulzer.tumblr.com/post/24141993116/12-reasons-you-should-switch-from-codeigniter-to
和 http://mulzer.tumblr.com/post/24141993116/12-reasons-you-should-switch-from-codeigniter-to
Now a bullets for Phalcon vs Laravel in speed: With Laravel + APC + a few other tweaks you can achieve something close to it while giving you all the flexibility that you gain from Laravel.
现在是 Phalcon 与 Laravel 的速度优势:通过 Laravel + APC + 一些其他调整,您可以实现接近它的目标,同时为您提供从 Laravel 获得的所有灵活性。
Finally if you need a side by side comparison: http://vschart.com/compare/phalconphp/vs/laravel
最后,如果您需要并排比较:http: //vschart.com/compare/phalconphp/vs/laravel
回答by herriekrekel
If it's just about speed take a look at this benchmark:
http://systemsarchitect.net/performance-benchmark-of-popular-php-frameworks/
如果只是关于速度,请查看此基准测试:http:
//systemsarchitect.net/performance-benchmark-of-popular-php-frameworks/
I would def go with phalcon since it's created on c level basically the same as if it is php itself.
我会选择 phalcon,因为它是在 c 级别创建的,与 php 本身基本相同。
EDIT:
编辑:
As of the writing of this edit, the site mentioned above is non-functional. Below is a snapshot from archive.org: https://web.archive.org/web/20160329072449/http://systemsarchitect.net:80/2013/04/23/performance-benchmark-of-popular-php-frameworks/
在撰写此编辑时,上述网站已无法使用。以下是来自 archive.org 的快照:https://web.archive.org/web/20160329072449/http://systemsaritect.net:80/2013/04 /23/performance-benchmark-of-popular-php-frameworks /