Postgres fly-replay vs NATS

I want to use the fly multi-region Postgres in ord (primary), fra and syd for a web app, but I need to write user action logs per web page view. I’m using Go in the backend and was thinking of accumilating these user action logs in batches and submitting them to the primary every 5 seconds via the fly-replay header.

Would it be more performant to use a NATS cluster for the batches instead?

If so, how do I deal with the following if the primary Postgres region automatically changes via Stolon:

  1. How do I detect in my Go code that the primary region has changed from say ord to fra?
  2. Do I need to also change anything in NATS if the postgres primary changes?

Also, which EU region is the most performant for users in the Western half of the EU, if I had to choose a single EU region?

I would also appreciate comments from other fly.io customers with experience with any of the above.

1 Like