Re: PHP Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There's a few things about your post I'd like to comment on.  One, if you're
not using APC, I definitely agree with the fact that you're just wasting
resources.  However, you mention micro-optimizations and say that they're
hardly useful, but in some cases it's a huge difference. ' vs. " is like a
0.1% speed difference or something equally negligible, but using
isset($foo['bar']) instead of in_array($foo, 'bar') is almost an exponential
speedup (it approaches that level of difference as the array size gets
larger and larger), so there are some definite good practices with common
fundamental structures that are worth paying attention to.  And finally, you
mention optimizing the LAMP stack, when the fact of the matter is the best
way to optimize that stack is to get rid of it.  Apache is huge and slow and
there are very fast and viable replacements for it (I use nginx, but a lot
of people are satisfied with lighttpd) and using either spawn-fcgi or fpm,
php concurrency can increase by as much as 50%.  And regarding MySQL,
installing XtraDB, Percona's enhanced InnoDB build with a whole boatload of
patches, is the easiest way to squeeze more performance out of MySQL.

To the OP, though, the point is that there is a definite scalability path
with regards to PHP and it's not something to really fret over, as there are
tons of documentation, talks, presentations, blog posts, strategies, etc to
achieve the most with PHP.  Although, in the end, PHP itself is rarely your
bottleneck, but instead the way you have your webserver setup bottlenecks
your clientele and the way you have your queries written bottlenecks your
server.  I don't want to say that PHP speed is negligible, but if you write
the world's worst PHP, but have an opcode cache and a fast DB implementation
(and a 100 ySlow score) no one is ever going to notice how bad your code is,
whereas someone else could write great code on a poorly performing site and
wind up in a much worse situation.

On Tue, Jun 2, 2009 at 10:20 AM, Topbit <topbit@xxxxxxxxx> wrote:

> On Tue, Jun 2, 2009 at 5:33 AM, tRace DOliveira <married_74@xxxxxxxxx>
> wrote:
> > I think that PHP is the best scripting language ever created...I'm
> currently doing a study of PHP and I want to know how APC can be used to
> improve PHP performance and how it can be implemented and also if there is
> some  other alternative other than APC of improving PHP performance ? The
> problem that I face is that as many requests are made the server is placed
> under alot of pressure and cannot deal with it....
>
> A large part of the reason PHP is so good at what it does is that
> scaling it up on a single, and then to multi-machine sites and from
> there to even millions of users is a well understood path.
>
> For APC, if you are running your own server and running a PHP site on
> there, if you're not already running APC or a similar caching system
> on there, you are just wasting CPU effort.
>
> There are a number of websites already out there that demonstrate the
> sort of caching and optimisations that can be performed on a LAMP
> stack, both within PHP code (but the various micro-optimisations of
> changing quotes and using one kind of array handling over another is
> only useful at the most extreme end of optimisations - and if you
> wonder if you need them - then you don't).  I'll be writing on the
> topic of scaling on my blog soon as well, so it might be useful to
> keep an eye on the in the next few weeks as well.
>
> For now, http://google.com/search?q=scaling+PHP will give you a lot of
> food for thought.
>
> Topbit
> http://topbit.co.uk/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux