cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: Web Performance
Date Fri, 19 Aug 2011 05:42:24 GMT
On 19/08/11 2:18 AM, Joe Baldwin wrote:
> This question has come up again, and I thought that I would try to research it but this
appears to be another "holy war".  I am looking for links to formal (or just professional)
studies done on PHP vs Java - based websites.  I am specifically trying to find out what the
real differences are when using an an advanced ORM (like Cayenne) with memory management and
performance optimization, vs well whatever the heck they use for PHP.
>
> My personal bias, I have done some programming in PHP and it it appears to be pretty
primitive to me. My perception is that it is something for high school student because it
is easy to run for very simple tasks.  However, complex advanced CMS would appear to be difficult
and a performance challenge for PHP, but then there is drupal.


I've actually done quite a bit of work in Drupal, so I know it fairly well. They achieve a
lot of speed by doing things like caching the entire rendered page in the database, this reduces
the number of SQL calls to deliver a previously cached page to essentially one. However my
personal opinion is that the speed of the language/environment is irrelevant. So what if one
is 50% faster than the other? Unless you are a Google engineer trying to get that tiny bit
of performance per watt per rack unit, for most of what we ordinary programmers are trying
to do, it is not terribly important. Stick another 24Gb of RAM into that server and upgrade
the CPU with another 4 cores.

Which leaves us with the important (IMO) metrics:

1. ease of finding programmers
2. ease of adding features and code maintenance
3. ease of finding/fixing bugs

For many open source projects, PHP wins because of (1). But it doesn't scale terribly well
to larger projects. (2) Becomes increasingly hard in PHP as the project gets large. PHP makes
it hard to write clean MVC style projects, use modern techniques like injection or write unit
tests. You can do these things, but you'll be fighting the framework. If you want a nice interpreted
language and framework which makes those things much easier, take a look at Ruby/Rails. It
has MVC and unit tests right at its core essence of being. And the ORM is not bad. Not as
nice as Cayenne :-) but still not bad. When it doesn't have bugs. Rails does suffer from being
a bit unstable and moving rather too fast with new features before they are ready. The ORM
syntax is quite neat. For example:

   Task.joins(:owners).where(:users => {:id => current_user}).order("tasks.weight DESC").limit(1).first

Andrus has discussed a similar query syntax for Cayenne in the past.


If your project can be built on top of Drupal (or another PHP Based CMS), then you have a
lot to gain by just extending the existing code with your own modules. I've done that quite
a few times and it works well for simpler projects (that is, where you are adding maybe 5-6
tables to the existing Drupal schema).

PHP and Rails projects often make use of memcache when they start to hit performance walls,
so you always have solutions to hardware scalability. But again, I believe you are focussing
on the wrong problem. Skilled staff and development effort, not hardware, is the real limitation.


Cheers

Ari



-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message