You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Matthew Schumacher <ma...@aptalaska.net> on 2005/07/20 17:30:43 UTC
Persistent DB connections for bayes_sql module.
List,
I moved my SA bayes store into my postgres database because I was
running into locking issues with the Berkeley DB.
The database is up and running fine, but I noticed that that connections
to the database are not persistent. As many of you know, postgres isn't
the fastest database during startup so I am sure this is hurting
performance quite a bit.
In fact I looked that the performance benchmarks on the spamassassin
site: http://wiki.apache.org/spamassassin/BayesBenchmarkResults and they
show postgres to be a terrible performer which would be true if the are
not using persistent database connections.
So the question is, is there a way to make SA use persistent
connections? I read though the docs and didn't see anything.
schu
Re: Persistent DB connections for bayes_sql module.
Posted by Michael Parker <pa...@pobox.com>.
Matthew Schumacher wrote
>Anyone have any ideas on how to fix this?
>
>
http://bugzilla.spamassassin.org/show_bug.cgi?id=2037
Michael
Re: Persistent DB connections for bayes_sql module.
Posted by Matthew Schumacher <ma...@aptalaska.net>.
Matthew Schumacher wrote:
> List,
>
> I moved my SA bayes store into my postgres database because I was
> running into locking issues with the Berkeley DB.
>
> The database is up and running fine, but I noticed that that connections
> to the database are not persistent. As many of you know, postgres isn't
> the fastest database during startup so I am sure this is hurting
> performance quite a bit.
>
> In fact I looked that the performance benchmarks on the spamassassin
> site: http://wiki.apache.org/spamassassin/BayesBenchmarkResults and they
> show postgres to be a terrible performer which would be true if the are
> not using persistent database connections.
>
> So the question is, is there a way to make SA use persistent
> connections? I read though the docs and didn't see anything.
>
> schu
>
I must be missing something here, I found code that seems to do exactly
what I want:
>From SpamAssassin/BayesStore/SQL.pm on line 134
==================================================================
return 1 if ($self->{_dbh}); # already connected
my $main = $self->{bayes}->{main};
$self->read_db_configs();
# Turn off PrintError and explicitly set AutoCommit to off
my $dbh = DBI->connect($self->{_dsn}, $self->{_dbuser}, $self->{_dbpass},
{'PrintError' => 0, 'AutoCommit' => 1});
if (!$dbh) {
dbg("bayes: Unable to connect to database: ".DBI->errstr());
return 0;
}
else {
dbg("bayes: Database connection established");
}
$self->{_dbh} = $dbh;
==================================================================
But I am not seeing any database connection persistence at all. I am
using mimedefang, but that uses SA like spamd does. Each child has it's
own SA object running for it's lifetime, so in theory, I should only see
connections when a new child starts up.
Anyone have any ideas on how to fix this?
schu