TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask YC: Speeding up PHP

10 pointsby apexaukabout 17 years ago
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 comments

djhomelessabout 17 years ago
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?
thamerabout 17 years ago
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 未加载
jawngeeabout 17 years ago
<a href="http://www.scribd.com/doc/88689/apcfacebook" rel="nofollow">http://www.scribd.com/doc/88689/apcfacebook</a>
评论 #208710 未加载
jrockwayabout 17 years ago
<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 未加载
missenlinxabout 17 years ago
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 未加载
blenderabout 17 years ago
You can use Xdebug to profile your application. KCacheGrind provides a pretty and useful GUI.<p>Cheers