利用C ++加速PHP [英] Making use of C++ to speed up PHP
问题描述
我在Sitepoint上看到这篇文章,引用Rasmus Lerdorf的一段话(根据Sitepoint):
使PHP快速?好吧,你不能是他的快速回答,PHP不够快,不能扩展到雅虎水平,PHP从来不是为了这些任务。任何基于脚本的语言是不够快这是真正大规模的Web系统所必须的,你必须使用编译的C ++扩展来获得真正的,可扩展的体系结构,这就是雅虎做的,所以许多其他PHP重量级。
通过语句(更不用说到目前为止,我在PHP中做的都是小数据库应用程序),我想知道如何使用编译的C ++扩展
任何想法或资源PHP是慢 ...你可以创建一个C ++和PHP的混合,但你需要做大量的剖析来理解什么是慢的,这主要是... PHP。
查看以下内容:
- C ++与PHP实际网络软件的基准
- 我的数据库是Web服务的瓶颈吗?(不是真的...或为什么wikimedia有这么多服务器)
- 关于Facebook的Slashdot文章(或多少资源PHP浪费)
。它是简单的写在PHP与现代的C + + Web框架和良好的知识在C + +。
从哪里开始:
I saw this post on Sitepoint quoting a statement by Rasmus Lerdorf which goes (according to Sitepoint) as follows:
How can you make PHP fast? Well, you can’t" was his quick answer. PHP is simply not fast enough to scale to Yahoo levels. PHP was never meant for those sorts of tasks. "Any script based language is simply not fast enough". To get the speed that is necessary for truly massive web systems you have to use compiled C++ extensions to get true, scaleable architecture. That is what Yahoo does and so do many other PHP heavyweights.
Intrigued by the statement (not to mention the fact that up to now, all I was doing in PHP was small database-based applications), I was wondering how I could "use compiled C++ extensions" with PHP.
Any ideas or resources?
Don't even bother. PHP is slow... You may create a mixture of C++ and PHP but you'll need to do lots of profiling to understand what is slow. And this is mostly... PHP.
See following:
- C++ vs PHP Benchmarks for real web software
- Is Data Base the Bottle Neck of Web Service? (not really... or why wikimedia has so many servers)
- Slashdot article about Facebook (or how many resources PHP wastes)
Just write in C++ in first place. It is as simple as writing in PHP with modern C++ web framework and good knowledge in C++.
Where to start:
- CppCMS - scalable MVC framework oriented for performance.
- Wt - framework that mimics Qt for web (not sure how it scales well).
这篇关于利用C ++加速PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!