duritong / puppet-trocla

puppet integration for trocla
11 stars 18 forks source link

Make us of Trocla.open #18

Closed martinpfeifer closed 8 years ago

martinpfeifer commented 8 years ago

Changes due to https://github.com/duritong/trocla/pull/37

martinpfeifer commented 8 years ago

Apparently i don't understand what trocla_set() does :( I tried to patch it but failed miserably. Maybe you can write a patch yourself O:-)

duritong commented 8 years ago

Thanks a lot for the suggestion and the patch over at duritong/trocla#37.

However, while it would address your particular problem I think it's the wrong approach. I just pushed bbedb78 and I think this a) also addresses your problem and b) is the more efficient solution to the problem. Mainly because using the new open method we would still create too many Trocla objects and e.g. would still require us to re-open database connections over and over again. IMHO this would add an additional overhead, while we should actually be able to just re-use the connection that moneta opened once, by just sticking to the same object. In the end this would then also allow the driver to make use of the connection pool you mentioned over at minad/moneta#85

I did a same implementation as Puppet did with hiera https://github.com/puppetlabs/puppet/blob/master/lib/hiera_puppet.rb so it should be as efficient there as hiera is, which can also have SQL backends or so.

Could you please test my new master and verify whether it addresses your problem? Otherwise we might need to dig deeper OR I completely understood something wrong.

martinpfeifer commented 8 years ago

I'll test it as soon as i have some time to spare :)

hggh commented 8 years ago

@duritong we have updated trocla and puppet-trocla to the current master branch and the massive numbers of open postgres database connections has dropped. for us your change was successfully, thanks!

duritong commented 8 years ago

Thanks for the feedback, so I'm closing here.

hggh commented 8 years ago

@duritong could you please also release a new trocla version?