loopbackio / loopbackio/loopback-next

Loopback not utilizing connection pool fully

Offen
#7,603 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

Using loopback datasources for postgres, we provided max connection pool of 20. As soon as app starts it makes two connection. When doing load test using jmeter, it is seen that only those two are being used. But after some time new connection were formed, to match the max number. But in any given second active connection were never more than 3. Also it was like utilizing a stack of connections because it is noticed that the last released connection was used. So, system was never able to use near 10-15 connections although they were there in idle state. This resulted in a tps of 160, for a process which comprised :

http in -> two db insert -> http out
The model had 200 fields, there are minimum validations, with no hooks, beforeSave, afterSave etc.

Attaching connection logs:

Start: <timestamp> => represents http in
Stop: <timestamp> => represents http out

DB-Write Start: <unique identifie><timestamp> => represents beginning of write process, handing it off to loopback
DB-Write Stop: <unique identifier><timestamp> => represents end of write process,

### 2021-07-01T13:26:39.589Z Acquired <connectionId> => represents acquiring process by pg, got using pg.pool.on('aquire',...)
releasing connection### <connectionId> => releasing of said connection back to pool
### 2021-07-01T13:26:40.148Z Connect <connectionId> => Making new connections

Thanks.
connect_findings.txt

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Es werden keine Quelldateien oder Tests genannt. Beginnen Sie mit der PostgreSQL-Datasource-Pool-Konfiguration und den angehängten Verbindungsprotokollen und reproduzieren Sie anschließend das gemeldete JMeter-Lastmuster. Als abgeschlossen gilt die Aufgabe, wenn geklärt ist, warum Verbindungen im Leerlauf des Pools nicht gleichzeitig verwendet werden, und das Verhalten dokumentiert oder korrigiert wurde, sodass die Auslastung dem konfigurierten Pool entspricht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
postgresql, typescript
Bereich
backend, databases
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.