Mercurial > dive4elements > river
view flys-backend/doc/schema/postgresql-setup.sh @ 5779:ebec12def170
Datacage: Add a pool of builders to make it multi threadable.
XML DOM is not thread safe. Therefore the old implementation only allowed one thread
to use the builder at a time. As the complexity of the configuration
has increased over time this has become a bottleneck of the whole application
because it took quiet some time to build a result. Furthermore the builder code path
is visited very frequent. So many concurrent requests were piled up
resulting in long waits for the users.
To mitigate this problem a round robin pool of builders is used now.
Each of the pooled builders has an independent copy of the XML template
and can be run in parallel.
The number of builders is determined by the system property
'flys.datacage.pool.size'. It defaults to 4.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 21 Apr 2013 12:48:09 +0200 |
parents | b0f14ff573d7 |
children |
line wrap: on
line source
#!/bin/bash # $1: user name and password for new DB (equals DB name) # $2: path to directory with schema-scripts # $3: host # run as user postgres (postgresql super-user) # it is assumed that the owner of the DB has the same name as the DB! # create PostGIS-DB createuser -S -D -R $1 createdb $1 createlang plpgsql $1 # Appears e.g. as /usr/share/postgresql/contrib/postgis-1.5/ on other systems. psql -d $1 -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql psql -d $1 -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql psql -d $1 -c "ALTER USER $1 WITH PASSWORD '$1';" psql -d $1 -c "GRANT ALL ON geometry_columns TO $1; GRANT ALL ON geography_columns TO $1; GRANT ALL ON spatial_ref_sys TO $1;" # add credentials to .pgpass (or create .pgpass) echo "*:*:$1:$1:$1" >> ~/.pgpass chmod 0600 ~/.pgpass # apply schema-scripts psql -d $1 -U $1 -h $3 -f $2/postgresql.sql psql -d $1 -U $1 -h $3 -f $2/postgresql-spatial.sql psql -d $1 -U $1 -h $3 -f $2/postgresql-minfo.sql