Skip to content

Conversation

@ekjotsinghmakhija
Copy link
Member

This pull request introduces changes to improve connection handling, enhance tenant-specific event tracking, and optimize code readability and maintainability. Key updates include adjustments to connection limits, the addition of tenant-based database event tracking, and minor refactoring for consistency.

Connection Handling Updates:

  • Updated max_connections in config/runtime.exs to 1000 with additional documentation explaining the calculation of total connections using num_acceptors.
  • Adjusted hard_limit and soft_limit in deploy/fly/prod.toml to 100,000 to align with the updated connection handling logic.

Tenant-Specific Database Event Tracking:

  • Introduced a db_events_per_second_key function in lib/realtime/tenants.ex to generate keys for tracking database events per tenant.
  • Added a start_db_rate_counter function in lib/realtime_web/channels/realtime_channel.ex to initialize counters for tenant-specific database events.
  • Integrated the new db_events_per_second_key into the message dispatcher to count database events per tenant. [1] [2]

Code Refactoring and Telemetry Enhancements:

  • Removed unused aliases GenCounter and Tenants from lib/extensions/postgres_cdc_rls/replication_poller.ex for clarity.
  • Added a new telemetry event [:realtime, :rate_counter, :channel, :db_events] in lib/realtime/telemetry/logger.ex for monitoring database events.

@ekjotsinghmakhija ekjotsinghmakhija merged commit 317ee4a into tealbase:main Jul 21, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant