Skip to content

Commit f115e3d

Browse files
committed
Speed up postgresql by disabiling durability settings.
Read: https://pythonspeed.com/articles/faster-db-tests/ I'm not using docker for postgresql at this time, but this article describes how to start a docker postgres image with disabled settings that may be of use if I end up having to change python 2.7 testing to use dockerized containers against dockerized database backends. However as a result of the above article, I took another look at: https://www.postgresql.org/docs/current/non-durability.html and switched off a few more settings. Also added some similar settings for mysql that was not in the deployed workflow. [skip travis]
1 parent 939b358 commit f115e3d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/ci-test.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ jobs:
122122
#grep max_allowed /etc/mysql/mysql.conf.d/mysqld.cnf
123123
#ls /etc/mysql/conf.d/ /etc/mysql/mysql.conf.d/
124124
#sleep 5
125+
# try to improve performance speed by disabling some ACID
126+
# settings and change some layout defaults.
127+
128+
echo "innodb_flush_log_at_trx_commit = 2" >> /etc/mysql/mysql.conf.d/mysqld.cnf
129+
echo "innodb_file_per_table = OFF" >> /etc/mysql/mysql.conf.d/mysqld.cnf
130+
echo "innodb_doublewrite=OFF" >> /etc/mysql/mysql.conf.d/mysqld.cnf
131+
echo "innodb_fast_shutdown=2" >> /etc/mysql/mysql.conf.d/mysqld.cnf
132+
echo "innodb_log_file_size=1048576" >> /etc/mysql/mysql.conf.d/mysqld.cnf
133+
echo "innodb_flush_method=O_DIRECT" >> /etc/mysql/mysql.conf.d/mysqld.cnf
134+
echo "innodb_log_buffer_size=3M" >> /etc/mysql/mysql.conf.d/mysqld.cnf
135+
echo "innodb_buffer_pool_size=180M" >> /etc/mysql/mysql.conf.d/mysqld.cnf
136+
sleep 3
125137
sudo service mysql restart
126138
#sleep 10
127139
#ps -ef | grep mysqld
@@ -131,9 +143,11 @@ jobs:
131143
- name: Install postgres
132144
run: |
133145
sudo apt-get update && sudo apt-get install postgresql
134-
# Disable fsync for speed, don't care about data durability
135-
# when testing
146+
# Disable fsync, full page writes for speed,
147+
# don't care about data durability when testing
136148
sudo sed -i -e '$a\fsync = off' /etc/postgresql/*/*/postgresql.conf
149+
sudo sed -i -e '$a\full_page_writes = off' /etc/postgresql/*/*/postgresql.conf
150+
sudo sed -i -e '$a\synchronous_commit = off' /etc/postgresql/*/*/postgresql.conf
137151
sudo service postgresql restart; sleep 10
138152
# set up postgresql database
139153
sudo -u postgres psql -c "CREATE ROLE rounduptest WITH CREATEDB LOGIN PASSWORD 'rounduptest';" -U postgres

0 commit comments

Comments
 (0)