3 ms·
This is somewhat mitigated by the buffer cache. The random writes are stored in RAM and hit the disk later on, possibly when it would have been idle. On a devel
by pmontra 11y ago
This is somewhat mitigated by the buffer cache. The random writes are stored in RAM and hit the disk later on, possibly when it would have been idle. On a developer laptop there is usually no difference. I remember I run some benchmarks with a pretty large test suite of a Rails application: POSTGRESQL in a ramdisk vs spinning disk: no difference in performance because the data never left the buffer cache. With substantial amount of data you hit the disk and solid state memory wins.
- fulafel 11y agoIf your PG setup leaves writes sitting in the buffer cache after transaction commits, it's not working right.
- pmontra 11y agoI'm sure that it persists them to disk but the test suite keeps running at the same speed, so it must happen when it's less inconvenient. Buying enough RAM to cache there all the DB is a common recommendation even if it can need some careful configuration http://dba.stackexchange.com/questions/18484/tuning-postgresql-for-large-amounts-of-ram http://dba.stackexchange.com/questions/18484/tuning-postgres...
- fulafel 11y agoStill sounds like it's not working right, unless it was a read-only test. Transaction commits force synchronous disk writes, meaning the transaction operation will not finish and return before the spinning disk has physically done one or more disk writes. (Unless you have an expensive storage system with non-volatile cache memory)
- pmontra 11y agoI don't think you can count on the file system to actually persist data on disk when you call flush(). Example http://rhaas.blogspot.it/2014/03/linuxs-fsync-woes-are-getting-some.html?m=1 http://rhaas.blogspot.it/2014/03/linuxs-fsync-woes-are-getti...