Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I build WEB application using MVC.
It will support multi-language(more than 10 languages)

I decided to store the localized data(captions for labels, buttons...) in DB.
When application is started, all localized data, according to selected language, is loaded to the cache(this avoids multi requests to DB).

Because of caching, I didn't felt(at least until now) the load on SQL server or IIS.

I thought about using .resx files and my questions are:
1 - Are using resources files better then using DB if thinking about performance issue?
2 - Will I fill the load on SQL server or IIS in the future?

P.S.: I know that one of the differences of using resources files vs DB that resources files must be recompiled each time I change the content of it.

Thank you
Posted

1 solution

1) I don't have any performance data, so this is apocryphal, but we used resource files on a large-scale governmental bilingual website and it worked out just fine.

2) There is no one-size-fits-all answer for this I'm afraid. It depends on your caching strategy (lazy-load or proactive load) and how heavily your application is used:

Lazy Load: Quicker start-uptime but the site will be slower as the cache is populated.

Proactive Load: Slower startup & heavy burden on the server(as the cache populates) but once ready, the site performace will be consitantly good.

You also have to conisider
a) How much memory os being taken up and will this effect performance (probably not, if done right)
b) Are you in a load balanced situation : each server will hit the DB each time
c)How is the data cached (I assume once per application)
d)How do you invalidate the cache, if the DB changes you need to reflect this in the cache to update the site.
e) How often are changes going to be made: the database is less hassle in this respect, but if you have a reasonably static text on the website resx might be a better option.

Personally, I've used resxs for this sort of thing, as I like to keep the data separate from the presentation stuff. On the downside the editor is a little clunky and keeping different languages in sync a pain, but in your case it would be a good idea to find/write a simple editor to do this.
 
Share this answer
 
Comments
TheAteist 8-Dec-10 12:49pm    
I understood what you wrote and I decided to use resxs files.
In resxs files I should hold localized data such as labels, buttons names, errors validation text and other small text. BUT, where I should hold the following data:
1 - localized articles. If I'll hold them in resxs files, wouldn't it "inflate" memory since the resx file, which is dll that loaded to the server memory, will be very "heavy"?
2 - small localized text like introduction/welcom text? The doubt is from the same consideration from (1).
Keith Barrow 8-Dec-10 12:55pm    
1: No worse than the cache I suppose, we didn't find them heavy on my old project
2: For common text, there is a gobal resx file. On the surface it is good, but (IIRC) you have to populate from code. It also breaks the link between the aspx and the aspx.resx.
Hope this answers your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900