8.0 jobrunner: support pgbouncer. named cursor to iterate jobs.#520
Open
8.0 jobrunner: support pgbouncer. named cursor to iterate jobs.#520
Conversation
Instead of fetching all jobs at once and then inserting them in the channels queue, fetch them by chunks of 2000 (default named cursor iterator behaviour since psycopg 2.4). This has the benefit of releasing the GIL periodically while loading jobs as well as consuming less memmory. backport of ae3e64ee27e8467380... and f0fc575fae36663409... with fixed line `for job_data in cr.fetchall():`.
pgbouncer is typically configured with `pool_mode = transaction` that does not support LISTEN/NOTIFY of postgre. support alt. `session` entry. LISTEN/NOTIFY is used by bus.bus (IM), web_auto_refresh, connector etc. Example odoo.conf: db_session_pool_mode_suffix = _bus Example pgbouncer.ini with additional entries in `pool_mode=session` (odoo_bus, postgres_bus): [databases] odoo = host=xx.xx.xx.xx port=yy dbname=odoo pool_mode=transaction odoo_bus = host=xx.xx.xx.xx port=yy dbname=odoo pool_mode=session pool_size=5 postgres = host=xx.xx.xx.xx port=yy dbname=postgres pool_size=20 postgres_bus = host=xx.xx.xx.xx port=yy dbname=postgres pool_mode=session pool_size=5 [pgbouncer] pool_mode = transaction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
for job_data in cr.fetchall():.db_session_pool_mode_suffixconfig.PGBouncer is typically configured with
pool_mode = transactionthat does not support LISTEN/NOTIFY of postgre. This patch adds support of additionalpool_mode = sessionentry, thus allowing connector module to work as it fully relies on LISTEN/NOTIFY.LISTEN/NOTIFY is used by
bus.bus(IM),web_auto_refresh,connectoretc.Example
odoo.conf:Example
pgbouncer.iniwith additional entries inpool_mode=session(odoo_bus,postgres_bus):