getlago / lago

Open Source Metering and Usage Based Billing API ⭐️ Consumption tracking, Subscription management, Pricing iterations, Payment orchestration & Revenue analytics
https://www.getlago.com
GNU Affero General Public License v3.0
7.04k stars 311 forks source link

[BUG]: Soem events do not come to lago when there is slight increase in load #411

Open Deathcall404 opened 1 month ago

Deathcall404 commented 1 month ago

We have a self hosted lago, but when we stream events, ( let's say more than 100 in 15s ). It doesn't show on loago dashboard in developers events section.

Did some research on the issue,

It is an issue with postgres connection. I exposed sidekiq endpoint and checked dead messages. The error message I saw was

ActiveRecord::ConnectionNotEstablished: connection to server at "xxx.xx.xx.xx", port 5432 failed: FATAL: remaining connection slots are reserved for roles with the SUPERUSER attribute

I will need a way to increase the number of max connection to the lago postgres db, is there any way I can do it through helm charts of lago.

Screenshot 2024-09-25 at 12 33 20 PM
vincent-pochet commented 1 month ago

Hello @Deathcall404,

Thank you for reporting this.

You can update the number of database connection on Lago's side by passing the DATABASE_POOL environment variable to the API and workers containers. You will have to check for the max number of connection that can be opened on Postgres side as well.

DATABASE_POOL appears to be missing in the documentation (https://doc.getlago.com/guide/self-hosted/docker), we will update it.