What should be in an "Ecto in Production" book?

help me finish this thought:

“I bought this ‘Ecto in Production’ book to help me with … and learn more about …”

The book doesn’t exist (yet) but i wonder what it should contain.

See Tweet

5 Likes

For one: A chapter about Ecto query plan cache.

By default Ecto caches query plans in a ETS table. Most times it is nice as now the planning-phase can be skipped saving some valuable time.

However, if the data in tables change the plan might not be optimal anymore and lead to worse results then having no cache.

There is an option to disable or influence the cache. When to set that option would be worth a section.

As this is probably never an issue in a dev environment; it’s perfect for a ‘in production’ book :slight_smile:

Found a blog about it: Elixir and Postgres: A Rarely Mentioned Problem | Lainblog

11 Likes

wild. thanks for that example; I hadn’t seen that before.

tldr for others, Postgres might cache a query plan that is efficient for the first couple of queries and therefore decide to reuse it too much later when it’s less efficient-- but you can force it to use a custom query plan for each query to avoid this issue.

3 Likes

… migrating the database without killing production.

2 Likes

Safe Ecto Migrations by @dbern :smiley:

5 Likes

How to connect your instances together (distributed erlang), and how to do this for umbrella apps as well.

Libcluster is a great tool, but so much of this is still trial and error.

Although, maybe this is best approached via a series of blog posts?

2 Likes

I like all of the ideas above :smiley:

Others that might be worth considering:

  • Scaling/optimisations
  • Security
  • Working with multiple databases
  • Working with legacy databases (such as when wanting to import data from a Rails DB into a new Phoenix app)
  • Working with apps built as separate components/applications (as per PragDave’s course)
  • Thoughts about using one big DB or splitting (perhaps linked to the above)
  • Creating an Ecto driver for new/other DBs
  • Transactions
  • Gotchas/things to look out for

Also… in case you’re open to the idea, what about expanding the topic to ‘Elixir in production’? I think a LOT of people might be interested in that (esp if it’s published by someone like PragProg or Manning) :003:

2 Likes

This sounds like “Elixir in Production” (also a wonderful book idea)-- is there an Ecto-oriented problem you’re facing here about connecting distributed instances to the database?

1 Like

Arg, you are so right!

This isn’t an “Ecto” topic at all, in fact, I failed to process the discussion correctly and read it as “Elixir” instead of “Ecto”.

I blame my early start for my slow-running brain, specifically, the 6:30am meeting.

Sorry for the noise.

2 Likes