Oracle: a compiled Cypher statement kept in the driver's statement cache holds megabytes of PGA, and a few dozen run the instance out (ORA-04036)
Maintainer antworten meist innerhalb von 1 Tag
Ein zugehöriger Pull Request wurde bereits gemerged.
- #221 von @jasperblues — gemerged
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 57/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- postgresql, python
- Bereich
- database, performance
Rechercherichtung
Start with drivine/connection/oracle/oracle_connection.py and drivine/sync/connection/oracle/oracle_connection.py, then check how OracleConnection.query and open_cursor prepare and execute Cypher statements. Port the described long-text memory test, measuring session PGA through v$sesstat as system; done means Cypher statements avoid the driver's statement cache and the test stays below 200 MB.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Port of liberation-data/drivine4j#313.
What happens here now. On Oracle, Oracle keeps a cursor's memory for as long as the driver keeps its statement in its statement cache. In drivine4j a compiled Cypher statement held about 4 MB of PGA while cached, 7 MB at 5,000 characters, and 10 to 24 MB when it read a text past 32 KB. A few dozen distinct statements took the instance from 300 MB to over 1.3 GB on one session. With more sessions that runs past Oracle Free's 2 GB PGA_AGGREGATE_LIMIT (ORA-04036). The memory is held on the server, not in the client, so any driver that caches the statement does the same.
OracleConnection.query and open_cursor (drivine/connection/oracle/oracle_connection.py:61 and :88, and drivine/sync/connection/oracle/oracle_connection.py:63 and :90) run a compiled Cypher statement with python-oracledb's default statement cache (stmtcachesize 20 per connection). The pool is set up in oracle_connection_provider.py with max=pool_max. So up to 20 compiled statements per session stay cached, each holding megabytes. This isn't measured here yet, but the cause is on the server side.
The fix in drivine4j (liberation-data/drivine4j#352): a statement compiled from Cypher isn't kept in the driver's cache on Oracle (statement.isPoolable = false), so it is closed when it ends. Drivine's own statements stay cached. The python-oracledb equivalent is cursor.prepare(statement, cache_statement=False) before execute, done only when the statement came from Cypher.
Tests to port.
OracleLongTextMemoryTest: 90 distinct long-text statements (givenWITH $t AS t, storedMATCH (n) WITH n.t AS t, madeWITH $a + $b AS t, each withleft(t, size(t) - i)) on one session. It reads that session'ssession pga memoryfromv$sesstatassystemand asserts it grew by less than 200 MB. In drivine4j it grew by 1,134 MB before the fix and by 37 MB after.- The long-text test now runs stored and made texts at 40,000 characters too, not only given ones.
- Vorherrschende Sprache
- Python
- Sterne
- 1
- Forks
- 0
- Ø Merge
- 1 Std. 29 Min.
- Gemergte PRs (30 T.)
- 136
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus liberation-data/drivine-python
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
liberation-data/drivine-python#250 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
liberation-data/drivine-python#209 ·
Maintainer antworten meist innerhalb von 1 Tag
-
CI: three Oracle-only tests in test_cypher_compiled.py never run, as -k oracle doesn't select themOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
liberation-data/drivine-python#178 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
liberation-data/drivine-python#297 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
liberation-data/drivine-python#295 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in liberation-data/drivine-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
namespace operations
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
EclipseFdn/open-vsx.org#15057 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
FinanceFlash/unvibecode#349 ·
-
Mission statement: why this is free, in the README, Why This Exists and the wiki HomeEvtl. vergeben @ChiefGyk3D hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
ChiefGyk3D/Clouds-Against-Humanity#348 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Perf] Default --vllm-watermark 0.05 for rollouts (hybrid models re-preempt under KV pressure)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
vllm-project/vime#508 ·
Maintainer antworten meist innerhalb von 4 Tagen