connection-poolingmahoutpg-jdbc

Mahout, PostgreSQL and connection pool


Using PostgreSQL as data source in Mahout 0.9, I keep getting

WARN org.apache.mahout.cf.taste.impl.model.jdbc.AbstractJDBCDataModel - You are not using ConnectionPoolDataSource. Make sure your DataSource pools connections to the database itself, or database performance will be severely reduced.

warning.

And it's true - each request keeps opening new connections.

Is there any way to use PGConnectionPoolDataSource for PostgreSQLBooleanPrefJDBCDataModel?

(currently I have no constructorfor arguments n Java::OrgApacheMahoutCfTasteImplModelJdbc::PostgreSQLBooleanPrefJDBCDataModel error)


Solution

  • In fact, you'll likely don't need a connections pool at all, as the right solution is to use memory-based ReloadFromJDBCDataModel wrapper, which, as the side-effect, decreases the number of connections to 1.