Project

General

Profile

Actions

Bug #1086

open

[infra] Fix max concurrent connection of Supabase

Added by Phước Ngọc Trần 13 days ago. Updated 13 days ago.

Status:
Resolved - Dev
Priority:
Normal
Category:
-
Start date:
09/06/2024
Due date:
09/06/2024 (14 days late)
% Done:

100%

Estimated time:
3:00 h
Spent time:

Description

- Khi release Supabase lên production cho user thực dùng, thì xảy ra tình trạng một lượng lớn user không nhận được notification. Lý do là soft limit của Supabase là 200 concurrent users. Nhưng thực tế lượng concurrent user dựa theo firebase là 1200. Nên cần phải research cách để tăng limit của concurrent user.

Actions #1

Updated by Phước Ngọc Trần 13 days ago

Cách fix:
- Tạo 1 custom tenant
- Set limit concurrent users cho custom tenant này.
- Thay đổi hostname container và kong config để traffic đi vào custom tenant này

Tài liệu để tạo custom tenant.
https://github.com/supabase/realtime?tab=readme-ov-file#server-setup

curl -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInxxxxxxx' \
  -d $'{
    "tenant" : {
      "name": "realtime-prd",
      "external_id": "realtime-prd",
      "max_channels_per_client": 100,
      "max_concurrent_users": 5000,
      "max_events_per_second": 500,
      "max_joins_per_second": 500,
      "jwt_secret": "yyyyyyyyyy",
      "extensions": [
        {
          "type": "postgres_cdc_rls",
          "settings": {
            "db_name": "postgres",
            "db_host": "db",
            "db_user": "postgres",
            "db_password": "xxxxxxxx",
            "db_port": "5432",
            "region": "us-east-1",
            "poll_interval_ms": 500,
            "poll_max_record_bytes": 1048576,
            "ssl_enforced": false
          }
        }
      ]
    }
  }' \
  http://localhost:4000/api/tenants && echo "" 
Actions #2

Updated by Phước Ngọc Trần 13 days ago

  • Status changed from In Progress to Resolved - Dev
  • % Done changed from 10 to 100
Actions

Also available in: Atom PDF