0

I am building a mobile app and am talking to postgres in the cloud. Imagine if my app ends up being a success, what is the recommended pattern to talk to the postgres database in the cloud -

Is it

a) Mobile App -> (some sort of authentication check) - > some queue like kafka-> database .

or

b) Mobile App -> (some sort of authentication check)  -> pgbouncer + postgres ?

or

c)    Mobile App -> (some sort of authentication check)  -> queue -> pgbouncer + postgres ?

I am trying to build an app that will stand the test of many many users concurrent using it , partly to become better at distributed systems. I expect the queries to return quickly.

Illusionist
  • 5,204
  • 11
  • 46
  • 76

1 Answers1

0

Depending on your needs, a) or d) would be the way to go, d) being to have a rest API to handle the requests.

b) and c) are no go: if you ever need to change your database (new IP, separate the data in several DBs, multizones etc), you are stuck and would need to update every app to use the new connection.

JGH
  • 15,928
  • 4
  • 31
  • 48
  • but I can just put an elastic ip or something on my database or a haproxy instance etc, and that will allow b and c – Illusionist Mar 14 '19 at 15:55