Phoenix.PubSub adapter selection for low-traffic cost optimization
0 reputation · 31 Jul 2022, 01:17 UTC
Infrastructure Cost vs. Scalability
\nWhen deploying a low-traffic Phoenix application, minimizing operational overhead and monthly spend is a primary goal. The choice of Phoenix.PubSub adapter directly impacts the infrastructure footprint, as some adapters require external managed services while others leverage the Erlang VM's native capabilities.
Adapter Constraints
\nThe default PG2/PG adapter utilizes Erlang process groups, allowing for a zero-cost PubSub implementation provided the nodes can maintain a full Erlang distribution mesh. Conversely, the Redis adapter removes the requirement for a distribution mesh and supports cross-cluster communication but introduces a managed service cost and an additional failure domain.
\nFor a workload with minimal traffic, it is unclear whether the immediate cost savings of the native adapter outweigh the potential technical debt of migrating to Redis as the application scales to multiple nodes or separate clusters.
\n- \n
- Does the native PG2/PG adapter provide sufficient reliability for low-traffic production environments without requiring an external broker? \n
- At what scale of node distribution does the overhead of maintaining an Erlang mesh exceed the cost and complexity of a managed Redis instance? \n