views:

222

answers:

4

I know there are already some questions on this topic on the site...

I am just trying to understand if it's safe to use ASP.NET Profile Provider with a website with huge traffic?

The way I see it, it's laid out inefficiently. You store property name (which is a string) and property value (which is a string too). If you are just trying to store even age in the profile, you are unnecessarily storing the string "age" in the database over and over whereas with a self-created table, you could just add a column titled age, and no redundancy?

(I am just trying to make sure I am not missing something about it, because I am fairly new to it.)

+6  A: 

The profile provider uses an EAV (Entity-Attribute-Value) design deliberately, because profiles in general very commonly have a sparsely populated schema - that is, there are many potential attributes, but only a few will be used for a given single entity, and the few that are used varies widely from one entity to the next.

Let's use a totally arbitrary example - let's say only one in 10 of your users want to provide their age. Making that a column now seems more like a waste, no?

But what if your application makes age mandatory? OK, that column gets populated for everyone. But what if you need to make a note in the profile "user doesn't want to see this obscure dialog anymore". Do you really want a column for every single dialog in your application whether a user wants to see it? Probably not. When you get into the little one-off details of an application of any significant scope, EAV actually becomes the more economical choice.

In the general, it scales quite well (far better than you probably think). In the specific, it doesn't matter - as always, use what works and fix performance problems when they come up. Whatever the scalability limitations of the profile provider are, you'll know when you hit them. I guarantee two things - (1) you'll have to fix a lot of other performance problems you didn't expect before you have to fix that; and (2) if your site is getting enough traffic to break the profile provider, it's a good problem to have.

Rex M
A: 

I agree with Rex M, unless you have a need to do things like sort all your users by age or do other procedures with aggregate profile data. Then you could consider rolling your own. But for just storing properties that you access here and there on a user-by-user basis, Rex M is right.

jayrdub
A: 

I do know what you mean. Wouldn't it make sense to supplment the profile provider's table with another table that has columns with mandatory fields? or do you think the overhead of join would not make it not worth it?

progtick
@progtick I assume you re-registered because you can't access the account you used to post the question... please go to http://meta.stackoverflow.com and ask them to merge your accounts. It will make it much easier to discuss questions and clarifications you have.
Rex M
I could not do so, because it's not apparently accepting my OpenId.
progtick
@progtick to answer your question, if you already have a database schema, it might make sense to build your own provider which uses that. However, making something a column alone doesn't make it mandatory - it already has to be enforced by your application logic. How it is stored in the database does not really affect whether it is required.
Rex M
A: 

No, I did not mean that by making the column, I would be able to make the age thing mandatory! But if I know my application is going to force users to enter age, then wouldn't it make sense to have a table that has a column dedicated to age? So, wouldnt it make sense to supplement asp's profile provider's table with my own table that has columns that I foresee are going to be mandatory?

No. Using a single model for all attributes is simpler. Making some arbitrarily columns and others rows has no benefit.
Rex M