I'm learning how to create a fast postgresql cluster to a web app in my job. I already know it's possible to create a tablespace on a virtual disk 1 2 3, mounted with ramfs or tmpfs, so my idea is:
- One or more masters are only used for writes. They're persistent on (physical) disk
- All slaves are mounted on RAM. If it fails because of, for example, an OS crash, no problem, because they're only used for reads.
Considering regular cache (memcached, redis, that kind of cache) isn't enough for our demand, because we need really fast reads with all features PSQL provides, how can I make this architecture reliable? Is there any better idea?
My current idea is create a master-cluster managed by heartbeat, to easy error recovering, and create a script that mounts the disk on ram, downloads the most recent dump and creates the database on it.