Best ways to limit concurrency to prevent overwhelming DB?

Hi

  1. Are these transactions mutually independent (i.e. later invocations do not require / depend on results returned from earlier invocations)

  2. Are these transactions required to be synchronous (i.e. when the request returns HTTP 200 / HTTP 201 do you need to guarantee that the data has been written)

  3. What is your desired performance profile (in terms of database… Transactions per Second)

  4. What is your actual performance profile and where are the bottlenecks

  5. What is the round-trip latency between your Elixir hosts and your database

Just a guess but it might get to a point where you will wake up one day realise that the database should be the warehouse into which you commit results, and that you can use another kind of data store to handle intermediate representations of your data or even keep it entirely in memory.

OR that you will write an expense report for a few grand, install a few SSDs and be done with it.

OR that you will change providers. I noticed that you had this thread open earlier… Phoenix API latency > 30s and wanted to say that one must keep in mind that Heroku Postgres is seldom the best Postgres can offer… you can explore some other offerings… AWS RDS… Amazon Aurora with PostgreSQL compatibility… Whatever that is available from GCE… Self-hosted solutions etc, etc, etc.

1 Like