javatokyo-cabinetkyotocabinet

What is "physical synchronization" of Kyoto Cabinet Database?


The function begin_transaction takes a boolean argument that indicates what type of synchronization should be done; physical when true or logical when false.

What does it mean when it refers to "physical", or hard, synchronization?


Solution

  • I am not exactly sure about the Java equivalents, but:

    EDIT:

    Apparently the equivalent of fsync() in Java is FileDescriptor.sync():

    http://download.oracle.com/javase/1.4.2/docs/api/java/io/FileDescriptor.html#

    The point is that to achieve true ACID semantics for a DB, all transactions should be synchronized to the permanent storage medium. Otherwise your application would have to be able to deal with transactions that failed silently - the DBMS would push the transactions to the filesystem and return successfully, but then the changes could get lost if e.g. the system lost power.

    The problem with physical synchronization is that it can have a significant impact on performance. Hard drives can handle a limited number of transactions per second (SSDs are a lot faster at this), which is why the first thing to do to improve DB performance is to bundle inserts in larger transactions.