0

There is little documentation available about wiredTiger on MongoDB website and it does not cover many configuration options listed on the wiredTiger website. Based on the wiredtiger documentation (http://source.wiredtiger.com/develop/tune_durability.html#tune_durability_flush_config), I included the transaction durability options as below -

storage:
    engine: "wiredTiger"
    wiredTiger:
        engineConfig:
            cacheSizeGB: 3
            configString: "log=(enabled),transaction_sync=(enabled=true,method=fsync)"

My question is, is this supported? The mongoDB server starts without complaining about this option, but how can I verify that it is in effect?

Thank you

Milind
  • 13
  • 1
  • 2
    What effect are you trying to achieve? Most likely there is a different correct way to get there. – Asya Kamsky Mar 23 '15 at 05:07
  • I want to persist the data on disk more frequently (if possible in real time). With MMAPV1, we could use the journaling, write concern and use commitinterval to tune this but what do we do with wiredTiger? – Milind Mar 23 '15 at 13:36
  • if you use write concern j:true then in WT it will result in journal being flushed synchronously - i.e. no write will be acknowledged till it's flushed to disk with the journal. You should not make any changes to the mongod config - just use j:true as default write concern (or on specific writes only, depending on your needs). I'll post it as the answer. – Asya Kamsky Mar 23 '15 at 21:24

1 Answers1

3

You clarified that you want to persist the writes to disk as frequently as possible, if possible in real time.

You can achieve that with WiredTiger without changing any of the startup parameters. Using writeConcern j:true or "journal acknowledged" your writes will be acknowledged only after they are written to the journal and flushed to disk. You can set your default writeConcern on the connection to j:true or you can set it on individual writes, depending on your requirements.

Asya Kamsky
  • 41,784
  • 5
  • 109
  • 133
  • Hi Asya, Thank you for your time and response. As mentioned ealrier, I am using wiredTiger engine and the storage.wiredTiger options do not include journal and commitIntervalMs parameters but they do for mmapv1. Can I instead change the replication settings to use fsync as below ? cfg.settings={ "chainingAllowed" : true, "heartbeatTimeoutSecs" : 10, "getLastErrorModes" : {}, "getLastErrorDefaults" : { "w" : "majority", "wtimeout" : 0, "fsync": true } } . Will this achieve the desired outcome of achieving highest possible transaction durability? – Milind Mar 27 '15 at 15:36
  • 1
    you should not ever use fsync:true as it just falls back to j:true and will be deprecated. Using j:true *is* the highest possible transaction durability (on a single server). if you have a replica set, adding w:majority will increase the durability across the cluster. WiredTiger doesn't include the same parameters as mmap because its default behaviors are different and it doesn't make sense to have a parameter for something that's already happening automatically (fsync'ing the journal on j:true synchronously). – Asya Kamsky Mar 28 '15 at 02:41
  • Thank you for the clarification. I have one more question for you - When you say synchronously, isn't it driven by the commitIntervalMs property that accepts lowest value of 2ms? Again, thank you for your time and patience. Appreciate your help. – Milind Mar 28 '15 at 05:08
  • 1
    no, commitIntervalMs right now only applies to mmap where it's asynchronous. It's synchronous in wiredTiger. See this request to add asynchronous option to WiredTiger: https://jira.mongodb.org/browse/SERVER-16609 – Asya Kamsky Mar 28 '15 at 18:31