views:

31

answers:

3

When considering social web app architecture, is it a better approach to document user social patterns in a database or in logs? I thought for sure that behavior, actions, events would be strictly database stored but I noticed that some of the larger social sites out there also track a lot by logging what happens.

Is it good practice to store prominent data about users in a database and since thousands of user actions can be spawned easily, should they be simply logged?

A: 

Obviously, it depends on what you want to do with it (and what you mean be "logging").

I'd recommend a flexible database storage. That way you can query it reasonably easily, and also make it flexible to changes later on.

Also, from a privacy point of view, it's appropriate to be able to easily associate items with certain entities so they can be removed, if so requested.

Noon Silk
+4  A: 

Remember that Facebook, for example, doesn't update users information per se, they just insert your new information and use the most recent one, keeping the old one. If you plan to take this approach is HIGHLY recommended, if not mandatory, to use a NoSQL DB like Cassandra, you'll need speed over integrity.

Information = money. Update = lose information = lose money.

Ben
What do you think about logging to XML since you could make the query-able? I'm wanting to keep things lightweight if possible and I think that a DB would be more resource expensive on drives. But their benefit could possibly outweigh the resource expense.
jlafay
A: 

You're making an artificial distinction between "logging" and "database".

Whenever practical, I log to a database, even though this data will effectively be static and never updated. This is because the data analysis is much easier if you can cross-reference the log table with other, non-static data.

Of course, if you have a high volume of things to track, logging to a SQL data table may not be practical, but in that case you should probably be considering some other kind of database for the application.

egrunin