2016-08-19

Raw devices or files? What is better?

One of the questions when a new device is to be created is if the device should be a raw device or a file. There are a couple of factors that should be taken into consideration:


  • Normal files are easier to manage. When database grows and you need to add a new disk space to the database, it is enough to create a new file and add it as a device to the database. In case of a raw device you have much more administrative work to do...
  • Normal files have better performance during writes to the disk. Files are usually buffered by OS, so modifying a file in memory is faster than sending the modification to the disk, however...
  • Raw devices are not using OS buffering and thus are reliable! We usually prefer to be 100% sure that data that was sent to the disk is indeed saved on the disk. If we would use OS buffering and a page would be sent to be saved on disk, and OS would say "page has been saved", but the page still resides in the memory buffer only and computer would be unexpectedly stopped then the database could be corrupted! So...
  • It is possible to enable DSYNC IO option for specified devices, but the result is that file performance is again comparable (if not worse) to raw devices. Another option allowing to ensure writes will not be lost is a DIRECTIO option causing file system buffers are omitted. 
  • What is 100% sure: double buffering by OS and by cache of ASE is wasting of RAM. Taking into account that we wish to write while skipping buffers, the advantage of OS buffering for read operations can be fully covered by large ASE cache. In this way reading on raw devices can be as good as on files while no data lost can be assured for writes, that in both cases should be done directly to the disk.
Having that info you probably see, that the biggest advantage of normal files is risky. Even if you decide to use normal files, you should probably not use OS buffering. Having all those in mind you can decide to use for example normal files for lower environments but raw devices on production, You can also decide to use normal files for non-real time applications, that could be restored to backup in case of corruption or for analytical/reporting databases, where you will be able to re import missing data, having better performance instead.

See also SAP Sybase Adaptive Server Enterprise Raw Devices vs File System published on SAP site. For impatient just skip to Summary paragraph.

No comments:

Post a Comment

SAP Adaprive Server Enterprise

SAP Adaprive Server Enterprise
SAP Adaprive Server Enterprise