Welcome Guest, Not a member yet? Register   Sign In
[updated] Web App Architechture Question
#11

[eluser]garymardell[/eluser]
I would have thought that the large the database the more you would be wanting to run your own queries. This way you can tweak them and optimize them in future.
#12

[eluser]Neeraj Kumar[/eluser]
that is ok but having some sort of ORM always kinda helps. Moreover I am from a RDBMS background, you know...
#13

[eluser]Johan André[/eluser]
[quote author="Codemaster Snake" date="1257019536"]that is ok but having some sort of ORM always kinda helps. Moreover I am from a RDBMS background, you know...[/quote]

ORM is just a automated way of doing queries.
If you write the sql yourself you can tweak it. It's (almost) impossible in
a ORM-environment. Alot of the queries does not need the fancy ORM-stuff but will problably get "over-complicated" when generated.

My tip is to write the queries yourself (it's not that hard when you get the hang of joins and other "advanced" sql-functions). Use ActiveRecord to save alot of trouble with escaping your statements.

The bottom line is: ORM is overrated and not good for hightraffic sites (in most cases anyway).
#14

[eluser]Neeraj Kumar[/eluser]
@johan, I have heard and read manier time that ORM is just a fancy way of dong things, But I have personally used it for a quite long time. I think I am kinda fond of OOP things.

Anyways, they do cut down the time and make a lot of things easier. Anyways I think I'll use ActiveRecord now.

But still I think Doctrine is a very good ORM. what say?
#15

[eluser]Burak Guzel[/eluser]
[quote author="Johan André" date="1257021124"]ORM is just a automated way of doing queries.
If you write the sql yourself you can tweak it. It's (almost) impossible in
a ORM-environment. Alot of the queries does not need the fancy ORM-stuff but will problably get "over-complicated" when generated.

My tip is to write the queries yourself (it's not that hard when you get the hang of joins and other "advanced" sql-functions). Use ActiveRecord to save alot of trouble with escaping your statements.

The bottom line is: ORM is overrated and not good for hightraffic sites (in most cases anyway).[/quote]

You could argue similar points about using a PHP Framework, yet we're here talking on the CodeIgniter forums.

With an ORM you can do several database and query optimizations with ease, that you wouldn't bother doing with manual coding. Even if you did, they would add quite a bit of development time. Like lazy loading, batching queries into transactions, result caching etc...

I am biased, as I'm building my new projects with CodeIgniter+Doctrine, but I am really enjoying the benefits so far.
#16

[eluser]BrianDHall[/eluser]
FYI, Datamapper and DMZ is actually built on top of CI's core implementation of ActiveRecord, which is itself basically an SQL builder helper class.

As for the database load, MySQL is pretty much designed for architectural scaling - one database can relatively easily be rolled out to run on a load-balanced cluster of database servers, or even a local virtualized cloud. Whether or not you need one or more databases is not really cut and dried, and is not likely to be difficult to address at a future date if and when such decisions need to be made. Before the system is even built and normal loads are established is far too early to start splitting databases for performance optimization - premature optimization is an almost universal evil.

And further optimization can be obtained with advanced database features and architecture, none of which need be considered so early on.

As for ORM performance, it is untrue that you cannot tweak ORM SQL queries easily. For instance:

Code:
$u = new User(1);

// can be rewritten as:
$u = new User();
$u->select('id', 1);
//or
$u->query('SELECT * FROM users WHERE id = 1');
//or
$u->get_where('id', 1);

Further, if in some theoretical world you have to do something like this:

Code:
$user->group->crazycategory->get_where_related('admin.specialtable', $admin)->supacrazy->get();

...and it produced some horrific and complex code that brought your system to its knees inside some super-tight loop, and Michael Jackson dropped by with his zombie minions and tried to help you but couldn't, and this was where 10%+ of your applications operating resources were being spent? Well then you call up the last query run to see what that super-crazy code was generating, you rewrite it to be super duper slim cause you are an ultra-cool 3133t H@x0r, then you stick it inside a simple raw query() call and you call it a day.

Since what is returned, or saved, or otherwise executed is pretty much the same no matter how you slice it or optimize it, little to none of the rest of your code should need to change.


When applications live and die in days, weeks, months, and billion-dollar internet companies are ripped to shreds in a few scant years, it is not CPU optimizations we lack - it is the ability to innovate and develop quickly and respond to user needs and demands in human time.

The reality is the huge majority of internet development projects are unsuccessful and die. Statistically it seems far wiser to roll the dice more times until you get something people like, than to build every application as though it were going to be hugely successful - because of course "almost all" of them simply won't be.




Theme © iAndrew 2016 - Forum software by © MyBB