Closed moylop260 closed 6 years ago
@moylop260 As you might be already aware, most of the optimization for reducing disk usage is already applied:
openerp_test=# SHOW fsync; SHOW synchronous_commit; SHOW checkpoint_timeout; SHOW full_page_writes; SHOW max_wal_size; SHOW autovacuum;
fsync | off
synchronous_commit | off
checkpoint_timeout | 45min
full_page_writes | off
max_wal_size | 1GB
autovacuum | on
The only parameter that seems promising is autovacuum | on
, that I'm guessing might be the cause for the high I/O of the collector.
Another alternative is to set all tables as unlogged, which is not currently the case:
openerp_test=# SELECT relname FROM pg_class WHERE relpersistence = 'u';
(0 rows)
However, AFAIK, that is not a feature that could be set by default, so we'd need to modify Odoo's code so all tables are created this way. To do so, CREATE TABLE
sentences would need to be replaced by CREATE UNLOGGED TABLE
here where model's tables are created and here where relational field's tables are created.
What do you think? Which one of these solutions do you think should be applied?
fsync off
Are these parameters available for all postgresql versions?
autovacuum off +1 @ruiztulio what docyou think?
CREATE UNLOGGED TABLE Maybe replacing the original one CREATE TABLE I dont know if it is possible
@moylop260
Yes, they're available for all versions. If you check any postgresql.conf
file, they all have the following lines at the end:
fsync=off
full_page_writes=off
checkpoint_timeout=45min
synchronous_commit=off
Not sure where these ones are added, though. There are not present in a standard installation, but they don't seem to be set up here in this project. Maybe they come from the shippable image?
@ruiztulio Yes, autovacuum may be enabled/disabled by default. However, what we really wonder is if tables may be created as unlogged by default, or at least I do.
@luisg123v The only way I know is during the create table or alter them after they are created. If it is done during the create this should be done only in test instances, because we need the WAL (I mention in case is done via odoo)
FYI I just ran the following command:
docker run -it --rm vauxoo/odoo-80-image-shippable-auto cat /etc/postgresql/9.6/main/postgresql.conf | grep "settings for extensions" -A40
I saw that we are using a custom configuration file:
# Add settings for extensions here
logging_collector=on
log_destination='stderr'
log_directory='pg_log'
log_filename='postgresql.log'
log_rotation_age=0
log_checkpoints=on
log_hostname=on
log_line_prefix='%t [%p]: [%l-1] db=%d,user=%u '
fsync=off
full_page_writes=off
checkpoint_timeout=45min
synchronous_commit=off
IMHO we should re-use the configuration file of @ruiztulio like as an include.
Running
docker run -it --rm vauxoo/odoo-80-image cat /etc/postgresql/9.6/main/postgresql.conf | grep "Add settings for extensions here" -A2
The output is:
include = '/etc/postgresql-common/common-vauxoo.conf'
@moylop260 Yes, it should be applied in all versions. See for example for v11:
and it's in all other images
For record,
updatedb
scriptNow,
postgres stats collector process
is not displayed anymore on iotop
output.load average
is 7 average. (Before it was 20)Thanks for the great works @ruiztulio and @luisg123v
Great! I'm glad to hear that @moylop260.
Currently, our runbot is consuming I/O disk from
postgres stats collector process
:The instances used for the big-image are semi non-durability type since that is not used for a production environment (just testing).
Then we could change the postgresql configuration (for all versions) in order to reduce the I/O disk.
Maybe, reducing
autovacuum
process too.Offtopic other process consuming I/O disk is:
I don't know if it is related with the
postgres stats collector process