[ensembl-dev] database connection issure

xiong zhao xiaoxiongg at gmail.com
Thu Feb 23 09:31:19 GMT 2012


thanks, today i found the  ensembl_web_user_db  which the connections open
all the time, so the number of connections increased rapidly. is it a bug
of Ensembl or something else?

Best regards,
Xiong

2012/2/22 Andy Yates <ayates at ebi.ac.uk>

> Hi Xiong,
>
> Ensembl does not use a connection pool instead it maintains a database
> connection for each instance of DBAdaptor. We do have two solutions to keep
> the number of open connections down.
>
> 1). Close the connection when you finish working with it e.g.
>
> my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor('human', 'core');
> # Do something with the DBAdaptor
> $dba->dbc()->disconnect_if_idle();
>
> Or if you were working with an adaptor e.g. a gene adaptor
>
> my $adaptor = Bio::EnsEMBL::Registry->get_adaptor('human', 'core', 'gene');
> #Do something with the adaptor
> $adaptor->dbc()->disconnect_if_idle();
>
> I would recommend doing this if you are iterating over many species and
> have a clearly defined point when you are finished processing a species.
> This is my preferred method of regulating open DB connections
>
> 2). The API can close down the connection for you automatically & reopen
> it when you need it again
>
> Bio::EnsEMBL::Registry->set_disconnect_when_inactive();
>
> I would use this version if you have a distributed setup and have no clear
> definition of when you have finished working with a species. Ensembl uses
> this version when we run pipelines. Please be aware of the associated
> overhead of recreating a connection.
>
> Hope this helps,
>
> Andy
>
> Andrew Yates                   Ensembl Core Software Project Leader
> EMBL-EBI                       Tel: +44-(0)1223-492538
> Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
> Cambridge CB10 1SD, UK         http://www.ensembl.org/
>
> On 22 Feb 2012, at 10:56, xiong zhao wrote:
>
> >
> >
> > On 22 February 2012 18:53, xiong zhao <xiaoxiongg at gmail.com> wrote:
> > hi,
> > do u know the ensembl database use connection pool? if it is, what's the
> name of the config file? because i found the number of the database
> connections is too much, but we just have a few of client.
> >
> > i really appreciate if you can help me.
> >
> > Thanks,
> > Xiong
> >
> > _______________________________________________
> > Dev mailing list    Dev at ensembl.org
> > List admin (including subscribe/unsubscribe):
> http://lists.ensembl.org/mailman/listinfo/dev
> > Ensembl Blog: http://www.ensembl.info/
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe):
> http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20120223/b5f80f23/attachment.html>


More information about the Dev mailing list