[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Sat Dec 27 13:55:20 UTC 2003
mwilkinson
Sat Dec 27 08:55:20 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv28511/Perl/MOBY/Client
Modified Files:
Central.pm
Log Message:
serious performance issues revealed by the new Gbrowse moby client program. The ISA call of MOB::Clien:Central requires two CGI calls, a SOAP call, which itself results in two CGI calls, and a myriad of independent database calls to traverse the ontology. It ended up being >1 second per call,which was unacceptable for many situations where you just need a quick answer to a 'what the heck is this' question. Started client-side caching of the ontology and LSID terms in Client::Central to speed things up. It is now only slow the first time, and <.05 seconds per call thereafter. It does show how critical the need is to start storing the ontology in memory on the server side, though.
moby-live/Perl/MOBY/Client Central.pm,1.65,1.66
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/26 22:01:31 1.65
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 13:55:20 1.66
@@ -1385,13 +1385,27 @@
my ($self, $class1, $class2) = @_;
return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
my $OS = MOBY::Client::OntologyServer->new;
- my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
- return 0 unless $s;
- my ($s2, $d2, $lsid2) = $OS->objectExists(term => $class2);
- return 0 unless $s2;
- my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1);
- my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
- foreach (@$lsids){
+ my ($lsid1, $lsid2);
+ unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){
+ my ($s, $d, $lsid) = $OS->objectExists(term => $class1);
+ $self->{LSID_CACHE}->{$class1} = $lsid;
+ $lsid1 = $lsid;
+ return 0 unless $s;
+ }
+ unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){
+ my ($s, $d, $lsid) = $OS->objectExists(term => $class2);
+ $self->{LSID_CACHE}->{$class2} = $lsid;
+ $lsid2 = $lsid;
+ return 0 unless $s;
+ }
+ my @lsids;
+ unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){
+ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']);
+ my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
+ @lsids = @$lsids;
+ }
+ $self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids];
+ foreach (@lsids){
return 1 if $_ eq $lsid2;
}
return 0;
More information about the MOBY-guts
mailing list