0

I am running a Postgres instance for a ~200GB database (including data and indexes). It's on a Google Compute Engine server. My options for disk are either network block storage or local SSD. I'm wondering if I can use local SSD as a caching layer for the database.

Network block storage is persistent but has relatively slow read/write and low IOPS. Local SSD has high throughput read/write and high IOPS, but is effectively transient and does not survive a shutdown of the instance.

I suppose I could run two Postgres instances: the master on network block storage, and a read-only copy on the local SSD. However, just like Linux automatically uses available ram as disk cache, I wonder if I can tell Linux to use the local SSD as a cache for the slower network block storage. Is anyone aware of how to go about that?

carbocation
  • 123
  • 3
  • PostgreSQL its self doesn't support any second-level cache. You might benefit form an application server level tool that supports a persistent second-level cache. – Craig Ringer Aug 22 '17 at 01:10
  • 1
    Another option could be to use ZFS as the filesystem, where the network block storage is the main component of the storage pool and part of the local SSD is the L2ARC cache and part is the ZIL (sort of write cache). However, I have no practical experience how this setup would perform in reality with database servers. – Tero Kilkanen Aug 22 '17 at 04:47

0 Answers0