TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask YC: Speeding up PHP

10 点作者 apexauk将近 17 年前
Just installed APC on our server (Alternative PHP Cache - http://uk2.php.net/manual/en/book.apc.php) and already seeing some great improvements in page load times/CPU usage per request. Particularly good for us as we're using Propel with lots of DB tables so already have 570+ .php files in the cache.<p>Any recommendations/gotchas, or should everything be fine out-the-box?<p>And while we're on the subject, what other recommendations have people got for speeding up/optimising PHP/LAMP?

6 条评论

djhomeless将近 17 年前
There is no right answer. Despite what others say, php is perfectly suited for a lot of needs. Runtime may be your issue, but you also have to think of supportability.<p>If your looking to optimize your site, as messenlinx suggested yslow is a good place to start. Next, I would suggest looking at your queries, ie a select statement across a big table vs. a more refined query across a smaller data set will do wonders regardless of the language.<p>If your data is updated infrequently, you can look at caching your queries in the data level. If not, maybe look at memcached?
thamer将近 17 年前
APC is very nice because you can really plug it in and expect to get performance improvements without any “real work.” That said, it really depends on your architecture and the traffic/usage patterns you expect. Do you get more reads? more writes? Do you use InnoDb or MyISAM?<p>Do you have a cache policy? For files? For DB data? Do you use the APC user cache or Memcached? The APC user cache is faster (on the web front-end), but is not shared. Memcached is shared but there will always be small network latency. If DB access is a bottleneck, consider using a data cache.<p>Do you serve a lot of static files? Consider using a CDN (not a silver bullet! There are drawbacks.)<p>There are a lot of strategies for high performance on <a href="http://highscalability.com/" rel="nofollow">http://highscalability.com/</a> . But don't overdo it! Most of the time you don't need to set up your infrastructure to be scalable for millions of clients.<p>As missenlinx pointed out, try also to speed up the page display by following Yahoo! recommendations on <a href="http://developer.yahoo.com/performance/rules.html" rel="nofollow">http://developer.yahoo.com/performance/rules.html</a> ; The number of requests per page is certainly something that made a difference when optimized, at least in my experience - YMMV.
评论 #208753 未加载
jawngee将近 17 年前
<a href="http://www.scribd.com/doc/88689/apcfacebook" rel="nofollow">http://www.scribd.com/doc/88689/apcfacebook</a>
评论 #208710 未加载
jrockway将近 17 年前
<i>what other recommendations have people got for speeding up/optimising PHP</i><p>Use a different programming language.<p>No, seriously. <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&#38;lang=php&#38;lang2=ocaml" rel="nofollow">http://shootout.alioth.debian.org/gp4/benchmark.php?test=all...</a><p>If runtime speed is your design goal, then you definitely want to think outside the PHP/Perl/Python/Ruby box. Those are fast enough for most people, but other languages are <i>a lot</i> faster. OCaml and Haskell are amazing; SBCL is pretty good too.
评论 #208859 未加载
missenlinx将近 17 年前
Best page i've seen around<p><a href="http://developer.yahoo.com/performance/rules.html" rel="nofollow">http://developer.yahoo.com/performance/rules.html</a>
评论 #208717 未加载
blender将近 17 年前
You can use Xdebug to profile your application. KCacheGrind provides a pretty and useful GUI.<p>Cheers