OHDSI / Achilles

Automated Characterization of Health Information at Large-scale Longitudinal Evidence Systems (ACHILLES) - descriptive statistics about a OMOP CDM database
https://ohdsi.github.io/Achilles/
130 stars 121 forks source link

Excessive connecting / disconnecting from server #716

Open schuemie opened 1 year ago

schuemie commented 1 year ago

During a standard Achilles run there are dozens or even hundreds of connect - disconnect actions. A primary cause is patterns like this, where a connection is opened and closed for every SQL statement (did you know DatabaseConnector::executeSql() accepts multi-statement SQL?)

Opening and closing this many connections is inefficient, and can lead to errors (some security layers do not allow this). ideally, Achilles would open a single connection once, and close it after it's done.

Note that it is possible to open a single connection per node in a cluster, and reuse that connection across jobs, as demonstrated here.