Open anthonyfok opened 3 years ago
Hi @drotheram, please assign me to this issue (and add labels, link to project, etc.) when you have time. Many thanks!
Tasks:
time
or with docker-compose logs?
)Relevant links:
Related links (to be sorted):
[MDLSITE-2152] Try out "eatmydata" on ci servers - Moodle Tracker
[RFC PATCH] docker: Add support for using eatmydata in the database
Don't set fsync=off if you want to keep your data - 2ndQuadrant | PostgreSQL
Postgres non-durable options Docker container. | No Todo Es Mecánico
How do I get into a Docker container's shell? - Stack Overflow
PostgreSQL - hackers - Asynchronous and "direct" IO support for PostgreSQL.
Misc:
One place to test this during psql: Running Create_all_tables_update.sql...
:
Without synchronous_commit=off
etc.:
python-opendrr_1 | 2021-05-20T18:13:20.046554364Z UPDATE exposure.canada_exposure SET geom = st_setsrid(st_makepoint(SauidLon,SauidLat),4326);
python-opendrr_1 | 2021-05-20T18:22:10.956967658Z UPDATE 2237515
With synchronous_commit=off
etc.:
[TODO]
Reminder (to self): Of the three parameters, only synchronous_commit
can be set with ALTER DATABASE
, and that was done in add_data.sh in PR #105:
$ psql opendrr -a
psql (13.3 (Debian 13.3-1))
Type "help" for help.
opendrr=> ALTER DATABASE opendrr SET fsync TO off;
ERROR: parameter "fsync" cannot be changed now
opendrr=> ALTER DATABASE opendrr SET full_page_writes TO off;
ERROR: parameter "full_page_writes" cannot be changed now
opendrr=> ALTER DATABASE opendrr SET synchronous_commit TO off;
ALTER DATABASE
opendrr=>
So, if we want to set fsync
and full_page_writes
to off
too, that will need to be done via #94, pending more benchmark and ways to ensure the database is fully written to the disk at the end of the docker-compose run.
synchronous_commit = off
has been implemented in the set_synchronous_commit() function in from add_data.sh:
full_page_write=off
and fsync=off
can or cannot be done from add_data.sh?To revisit in year 2022. :-)
2021-11-22 update: This issue was essentially fixed in PR #105 (Pipeline optimization, Sprint 34–36) merged in June 2021; see [https://github.com/OpenDRR/opendrr-api/issues/77#issuecomment-975802148](reasons why I am keeping this issue open for the time being]
docker-compose up --build
currently takes several hours to run. In particular, importing data into PostgreSQL database seems somewhat slow to me, apparently synchronizing to the physical disk for each single operation.It turns out there are PostgreSQL settings to optimize its speed, and some users report like 10x speed improvement for e.g. CI test runs.