I'm developing one Blog Website and I'm wondering how you can save the big blog publish data - inside a XML file, like a HTML file or directly in database. Any suggestion?

A database could be much better. So save an XML file (or other file), you have to overwrite the whole factor. A database enables you to definitely add/update an archive at any given time.

As well as a DB is simpler to look if you are searching for all blogs having a certain word or phrase...

Select one.

I would not suggest HTML, because you can decide to render it another way sooner or later, but XML along with a DB have their up-sides and lower-sides. XML Files, presuming you mean one publish per file, are highly portable, easilly editable, etc. A DB store is simpler to look and retrieve and just a little not as likely accidentally to become erased.

XML isn't a sensible choice if this involves saving/loading/serializing/deserializing large data. i would suggest utilizing a database.

Your blog publish isn't large. Images may be.

Some questions:

  • What database are you currently using? If you are using MySQL (ick), you'll most likely desire to use the written text (for <64K) or MEDIUMTEXT (for between 64K and 16M).
  • Exactly what do you mean by "XML"? XHTML is XML. HTML5 comes with an XML serialization.
  • Would you mean one-file-per-publish? I am presuming you need to do.

Items you might consider:

Do you know the issues you are thinking about?

  • Read performance: Could it be faster to fetch a filename in the database after which browse the file, or simply fetch the information in the database? Should you ensure that it stays all within the database, you skip more system calls. Additionally you steer clear of the "plenty of small files" (around or under 4K) problem which most filesystems can be harmful at.
  • Write performance: It may be faster to create personal files rather than email the database, due to the fact the database provides much more guarantees (transactional integrity). However, you will need to email the database anyway, so adding more files might mean more seeks.
  • Database expenses: Storing more data within the database makes VACUUM Evaluate take more time.
  • Transactions: If your DB write fails, the transaction fails. When the disk will get full, an ordinary file write will partly complete. Does your code properly handle that, or will it simply save the beginning of the publish?
  • Removing (associated with transactions): You will need to make sure to remove the file too. Let's say removing the file fails? Let's say removing the row fails?
  • Migration: You will need to copy the database. Would you like to copy plenty of small files too?
  • Convenience: Would you like to modify posts inside a text editor?
  • Orphaned/missing files: Let's say you will find posts without files, or files without posts?