~/talk

The Very Hungry Transaction

Talkat RailsConf 2024 · 2024-05-07..05-09· [ruby-on-rails, databases]
slides:none on file

A single database transaction grows into a liability: inserts plus hundreds or thousands of updates cause deadlock errors and lock timeouts, slow queries and transactions over several seconds create contention, and an external HTTP call inside a transaction ties up DB connections until the external service times out causing sitewide failures. Background jobs enqueued before commit generate retries and queue backups; switching to after_create_commit enqueues only on success, add indexes to speed updates, and limit batch sizes to avoid thousands of queries.

AI-written summary · about

  1. 0:00Introduction
  2. 1:06Cat and hungry transaction story
  3. 3:16Monday’s simple transaction
  4. 5:02Tuesday’s inventory update and locks
  5. 9:19Slow transactions invite contention
  6. 10:00Speeding up update queries
  7. 12:29Questioning transaction need
  8. 12:50Moving work out of request
  9. 13:33Jobs before commit can fail
  10. 15:01Queued retries blocking jobs
  11. 16:27Wednesday’s job improvements
  12. 16:49Thursday’s external call
  13. 18:14External calls threaten database
  14. 20:21Moving calls outside transactions
  15. 21:44Friday’s database overload
  16. 22:47Nested transactions risks
  17. 24:11Non-atomic inventory updates
  18. 25:14Making operations explicit
  19. 26:39Weekend reflections on risks
  20. 27:43Slow transactions affect app
  21. 28:46Monday’s monster transaction
  22. 29:28Rewriting transactions
  23. 30:32Rails 7.2 deferring work
  24. 30:54Tools for transactions
  25. 31:36Preventing bad transactions
  26. 32:20Writing safe transactions
  27. 33:44GitHub’s real problems
  28. 34:05Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.