Commit c64e4442 authored by Leigh B Stoller's avatar Leigh B Stoller

A couple performance tweaks; throw away massive data structures we no

longer need, expecially XML objects.
parent c5c937b8
......@@ -3648,6 +3648,11 @@ sub GetTicketAuxAux($$$$$$$$$$$)
goto bad;
}
}
#
# Kill this, it sucks up a lot of memory and if this is a CreateSliver()
# we will hang onto it in the next two phases.
#
$virtexperiment->Flush();
#
# For the version 2 minimal API, just return the annotated rspec.
......
......@@ -556,6 +556,8 @@ sub CreateSliver($)
# Free this possibly massive XML structure, we do not need it anymore.
undef $rspec;
# Purge all the XML objects from the slivers, we do not need them again.
GeniSliver->PurgeRspecs();
#
# At this point we want to return and let the startsliver proceed
......
......@@ -143,15 +143,6 @@ sub Lookup($$)
$self->{'RSPEC'} = undef; # server
$self->{'CERTIFICATE'} = undef;
my $rspec_string = $self->{'SLIVER'}->{'rspec_string'};
if (defined($rspec_string) && $rspec_string ne "") {
my $rspec = GeniXML::Parse($rspec_string);
if (!defined($rspec)) {
return undef;
}
$self->{'RSPEC'} = $rspec;
}
#
# Grab the certificate, since we will probably want it.
#
......@@ -284,12 +275,15 @@ sub Create($$$$$$$$)
return undef
if (!defined($sliver));
# This is lazy, but since we have it, keep it.
$sliver->{'RSPEC'} = $rspec;
$sliver->{'AGGREGATE'} = undef;
$sliver->{'SLICE'} = undef;
if (GeniUsage->NewSliver($sliver, $slice, $owner)) {
print STDERR
"GeniSliver::Create: GeniUsage->NewSliver($sliver) failed\n";
}
$sliver->{'AGGREGATE'} = undef;
$sliver->{'SLICE'} = undef;
return $sliver;
}
......@@ -315,7 +309,6 @@ sub state($) { return field($_[0], "state"); }
sub status_state_timestamp($) { return field($_[0], "status_state_timestamp"); }
sub ErrorLog($) { return field($_[0], "errorlog"); }
sub cert($) { return GetCertificate($_[0])->cert(); }
sub rspec($) { return $_[0]->{'RSPEC'}; }
# Watch for slivers that no longer get a certificate.
sub GetCertificate($)
{
......@@ -405,6 +398,39 @@ sub GetManifest($$)
return $xml;
}
#
# Lets create this lazily, these XML objects are really big and we do not
# need them very often.
#
sub rspec($)
{
my ($self) = @_;
return $self->{'RSPEC'}
if (defined($self->{'RSPEC'}));
my $rspec_string = $self->{'SLIVER'}->{'rspec_string'};
return undef
if (!defined($rspec_string) || $rspec_string eq "");
my $rspec = GeniXML::Parse($rspec_string);
return undef
if (!defined($rspec));
$self->{'RSPEC'} = $rspec;
return $rspec;
}
#
# Purge all the rspecs from the cached slivers.
#
sub PurgeRspecs($)
{
foreach my $sliver (values(%slivers)) {
$sliver->{'RSPEC'} = undef;
}
}
#
# Store the rspec/manifest string.
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment