You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">maxshared</span></tt>: Obergrenze für die Anzahl gemeinsam genutzer Verbindungen
368
-
(der Standardwert <ttclass="docutils literal"><spanclass="pre">0</span></tt> bedeutet, dass alle Verbindungen dediziert sind)</p>
368
+
(der Standardwert <ttclass="docutils literal"><spanclass="pre">0</span></tt> oder <ttclass="docutils literal"><spanclass="pre">None</span></tt> bedeutet, dass alle Verbindungen
369
+
dediziert sind)</p>
369
370
<p>Wenn diese Obergrenze erreicht wird, werden Verbindungen wiederverwendet,
370
371
wenn diese als wiederverwendbar angefordert werden.</p>
371
372
</li>
372
373
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">maxconnections</span></tt>: Obergrenze für die Anzahl an Datenbankverbindungen,
373
374
die insgesamt überhaupt erlaubt werden sollen (der Standardwert <ttclass="docutils literal"><spanclass="pre">0</span></tt>
374
-
bedeutet unbegrenzte Anzahl von Datenbankverbindungen)</p>
375
+
oder <ttclass="docutils literal"><spanclass="pre">None</span></tt>bedeutet unbegrenzte Anzahl von Datenbankverbindungen)</p>
375
376
</li>
376
377
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">blocking</span></tt>: bestimmt das Verhalten bei Überschreitung dieser Obergrenze</p>
377
378
<p>Wenn dies auf <ttclass="docutils literal"><spanclass="pre">True</span></tt> gesetzt wird, dann wird so lange gewartet, bis die
ihre eigenen Mechanismen zum Pooling von Datenbankverbindungen eingebaut.
479
480
Tatsächlich hat <aclass="reference" href="http://www.sqlobject.org/2/">SQLObject 2</a> (<aclass="reference" href="http://www.sqlobject.org/sqlapi/">SQL-API</a>) das Pooling in eine separate Schicht
480
481
ausgelagert, in der Code von DBUtils verwendet wird.</p>
482
+
<p>Wenn Sie eine Lösung verwenden wie den Apache-Webserver mit <aclass="reference" href="http://www.modpython.org">mod_python</a>
483
+
oder <aclass="reference" href="http://code.google.com/p/modwsgi/">mod_wsgi</a>, dann sollten Sie bedenken, dass Ihr Python-Code normalerweise
484
+
im Kontext der Kindprozesse des Webservers läuft. Wenn Sie also das
485
+
<ttclass="docutils literal"><spanclass="pre">PooledDB</span></tt>-Modul einsetzen, und mehrere dieser Kindprozesse laufen, dann
486
+
werden Sie ebensoviele Pools mit Datenbankverbindungen erhalten. Wenn diese
487
+
Prozesse viele Threads laufen lassen, dann mag dies eine sinnvoller Ansatz
488
+
sein, wenn aber diese Prozesse nicht mehr als einen Worker-Thread starten,
489
+
wie im Fall des Multi-Processing Moduls "prefork" für den Apache-Webserver,
490
+
dann sollten Sie auf eine Middleware für das Connection-Pooling zurückgreifen,
491
+
die Multi-Processing unterstützt, wie zum Beispiel <aclass="reference" href="http://pgpool.projects.postgresql.org">pgpool</a> oder <aclass="reference" href="http://pgbouncer.projects.postgresql.org">pgbouncer</a>
(the default of <ttclass="docutils literal"><spanclass="pre">0</span></tt> means no connections are made at startup)</p>
338
338
</li>
339
339
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">maxcached</span></tt>: the maximum number of idle connections in the pool
340
-
(the default value of <ttclass="docutils literal"><spanclass="pre">0</span></tt> means unlimited pool size)</p>
340
+
(the default value of <ttclass="docutils literal"><spanclass="pre">0</span></tt>or <ttclass="docutils literal"><spanclass="pre">None</span></tt>means unlimited pool size)</p>
341
341
</li>
342
342
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">maxshared</span></tt>: maximum number of shared connections allowed
343
-
(the default value of <ttclass="docutils literal"><spanclass="pre">0</span></tt> means all connections are dedicated)</p>
343
+
(the default value of <ttclass="docutils literal"><spanclass="pre">0</span></tt>or <ttclass="docutils literal"><spanclass="pre">None</span></tt>means all connections are dedicated)</p>
344
344
<p>When this maximum number is reached, connections are shared if they
345
345
have been requested as shareable.</p>
346
346
</li>
347
347
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">maxconnections</span></tt>: maximum number of connections generally allowed
348
-
(the default value of <ttclass="docutils literal"><spanclass="pre">0</span></tt> means any number of connections)</p>
348
+
(the default value of <ttclass="docutils literal"><spanclass="pre">0</span></tt>or <ttclass="docutils literal"><spanclass="pre">None</span></tt>means any number of connections)</p>
349
349
</li>
350
350
<li><pclass="first"><ttclass="docutils literal"><spanclass="pre">blocking</span></tt>: determines behavior when exceeding the maximum</p>
351
351
<p>If this is set to true, block and wait until the number of
or <aclass="reference" href="http://www.sqlalchemy.org">SQLAlchemy</a>, you won't need DBUtils, since they come with their own
443
443
connection pools. <aclass="reference" href="http://www.sqlobject.org/2/">SQLObject 2</a> (<aclass="reference" href="http://www.sqlobject.org/sqlapi/">SQL-API</a>) is actually borrowing some code
444
444
from DBUtils to split the pooling out into a separate layer.</p>
445
+
<p>Also note that when you are using a solution like the Apache webserver
446
+
with <aclass="reference" href="http://www.modpython.org">mod_python</a> or <aclass="reference" href="http://code.google.com/p/modwsgi/">mod_wsgi</a>, then your Python code will be usually run
447
+
in the context of the webserver's child processes. So if you are using
448
+
the <ttclass="docutils literal"><spanclass="pre">PooledDB</span></tt> module, and several of these child processes are running,
449
+
you will have as much database connection pools. If these processes are
450
+
running many threads, this may still be a reasonable approach, but if these
451
+
processes don't spawn more than one worker thread, as in the case of Apache's
452
+
"prefork" multi-processing module, this approach does not make sense.
453
+
If you're running such a configuration, you should resort to a middleware
454
+
for connection pooling that supports multi-processing, such as <aclass="reference" href="http://pgpool.projects.postgresql.org">pgpool</a>
455
+
or <aclass="reference" href="http://pgbouncer.projects.postgresql.org/">pgbouncer</a> for the PostgreSQL database.</p>
0 commit comments