Data FAQ

Should I use XML or SQL Server?

Composite C1 can run on XML files or Microsoft SQL Server - which one should I choose?

Answer:

Choosing between XML or SQL as data store for your Composite C1 site depends on a number of factors. Below we have collected relevant information that can help you decide what store to use – if you are in doubt we recommend that you stick with XML, and then migrate to SQL if you one day feel the need. Migration from XML to SQL is very easy.

XML as a data store – the default

When you set up a new Composite C1 site it will be storing data in XML files by default. Data is stored in files located in the folder ~/App_Data/Composite/DataStore.

The XML is loaded into memory (as type safe data objects) making reading data extremely fast. Since the XML Data Provider keeps all data in memory, you can however run out of memory at some point. Please note that if an XML file is 100 MB, it might take up to 300MB of memory when loaded.

Writing data is done directly to the file on disk, making write speed dependant on file size (large XML files take longer to serialize). It's worth considering that frequent writes to huge files may cause data corruption and /or wear off your disks

XML pros: XML based websites are very easy to manage. Very good read performance. Since the XML files are stored on the file system as part of the website, this option requires no configuration and you can easily move your website around, take a backup etc. using simple xcopy’ing. You do not require SQL Server, cheaper to host.

XML cons: If you have very large amounts of data or you have frequent data updates performance can become an issue. With a large data store, you can run out of memory. Frequent writes to huge files may cause data corruption. You do not have tools like SQL Server Management Console and a SQL prompt.

Important. If there are >= 10625 rows for 64bit processes or >= 21250 rows for 32bit processes, the IIS worker process will consume all available memory and lots of CPU time afterwards, which will make the server quite unresponsive.

Microsoft SQL Server as a data store

You can migrate your existing XML based website to SQL Server , typically in a matter of minutes and without any code changes. Once running on SQL Server you will find your data placed in tables and columns that map logically to the data types and fields you have on your website.

SQL pros: Performs well even with large amounts of data and intensive data updates. C1 Console data operations are transactional, website data easily available using SQL Server based tooling.

SQL cons: Website management (deploying, backup) become more complicated and error prone.

Note: You can also migrate an SQL-based website back to an XML-based data store using the Data Store Migrator tool.