critic icon indicating copy to clipboard operation
critic copied to clipboard

Add --database-host option

Open mattpatey opened this issue 10 years ago • 3 comments

Add --database-host option to define a non-local PostgreSQL database to be used by Critic host at installation time. By default --database-host is set to "localhost", which is how Critic is currently hardwired to run. This makes running Critic in a Docker container or other environment where the database host is not running on the web host feasible.

mattpatey avatar Jul 24 '15 12:07 mattpatey

Thanks for the patch! I've imported it to our Critic system for review, and mostly for automatic testing. (Which shows some errors: using "-h localhost" to psq is not quite equivalent to not using a -h argument at all, it seems.)

Critic review here: https://critic-review.org/r/341

One initial thought I have about this otherwise is that there might be some performance with using a separate database hose. I'd imagine some kind of connection caching or such might be necessary then, which I simply haven't bothered looking into since it definitely doesn't seem necessary when connecting to the database server locally.

jensl avatar Jul 27 '15 10:07 jensl

(Which shows some errors: using "-h localhost" to psq is not quite equivalent to not using a -h argument at all, it seems.)

I've set the default database host to /tmp, which is the documented default value.

One initial thought I have about this otherwise is that there might be some performance with using a separate database hose. I'd imagine some kind of connection caching or such might be necessary then, which I simply haven't bothered looking into since it definitely doesn't seem necessary when connecting to the database server locally.

How about using psycopg2's connection pooling feature?

mattpatey avatar Jul 27 '15 14:07 mattpatey

@jensl When trying to figure out what to set maxconn to I assumed that it would be sufficient to use the same value as in the WSGIDaemonProcess threads parameter (default: 25), however looking at the process tree on a system running Critic, there appeared to be 27 threads for each Apache process running Critic. Any idea where the two additional threads might come from? And what would you suggest setting the maximum number of connections to?

mattpatey avatar Jul 28 '15 09:07 mattpatey