Software Engineering
c# xml file-storage
Updated Mon, 13 Jun 2022 11:40:06 GMT

File storage for a blog component: database or filesystem?

I'm going to develop a fairly basic re-usable blog component, with simple CRUD operations using ASP.Net.

Which method of storing blog posts would be best suited to the situation in terms of performance/maintainability?

  • Create an XML file and store data in filesystem, filesize will not likely be any more than 50kb in size
  • Store blog post data in DB, retrieve as needed

Am I right in assuming that the runtime will cache the .xml files and only clear them/request a fresh copy when their contents are changed? Or do you have to explicitly add the file to the cache? If this is the case would this offer the best performance over storing the data in the database?


Use a database, thats what they are for. File storage has its place, but I wouldnt use it for this kind of scenario. Consider, for example, getting a list of blog posts containing a certain tag. Doing that with a database is trivial - likely just a single SQL statement. Doing it with files will involve a lot of file manipulation.

Comments (2)

  • +0 – You're probably right. In addition, if i went the .xml route, i'd have to store an ID or something unique in the file to tie that post to comments/tags etc.. which could become quite messy +1 — Apr 29, 2013 at 19:18  
  • +0 – There are many other reasons, but yes, a database is the way to go. — Apr 29, 2013 at 19:26