a JSON or GraphQL API) WHAT IS A PHOENIX APP? Data Layer Application Layer Presentation Layer Postgres Phoenix Contexts + Ecto LiveView/Absinthe/Controller
and traces OpenTelemetry • • • Trace: Lifecycle of a request across services Span: Single unit of work in a trace Event: Specific action within a span Distributed Tracing OPENTELEMETRY
Data Size PRODUCTION VS DEV • Some problems only happen when there are concurrent requests coming from many users Load • Latencies between services can make some problems much worse Latency
it explicit Solution is normally batching/preloading Ecto: preload LiveView: update_many Absinthe: DataLoader N+1 SUMMARY • • • Requires lower level profiling fprof, cprof, eprof, eflambe Solution will vary, but a lot of the times some preprocessing goes a long way Slow Code • • • • Distributed tracing can help pointing out the specific query to analyse Postgres EXPLAIN will give you insight on what is wrong PEV2 will help you visualize it Solutions will vary: indexes, data denormalization, preprocessing, extra conditions to reduce result set Slow Query