mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-08 23:26:12 +02:00
Add performance module and basic performance test for archive-push.
This commit is contained in:
parent
9e248a6627
commit
9e9286ee20
@ -301,6 +301,10 @@
|
|||||||
<release-item>
|
<release-item>
|
||||||
<p>Automatically check that all supported <postgres/> versions are being tested on a single default VM.</p>
|
<p>Automatically check that all supported <postgres/> versions are being tested on a single default VM.</p>
|
||||||
</release-item>
|
</release-item>
|
||||||
|
|
||||||
|
<release-item>
|
||||||
|
<p>Add <id>performance</id> module and basic performance test for <cmd>archive-push</cmd>.</p>
|
||||||
|
</release-item>
|
||||||
</release-refactor-list>
|
</release-refactor-list>
|
||||||
</release-test-list>
|
</release-test-list>
|
||||||
</release>
|
</release>
|
||||||
|
@ -418,6 +418,18 @@ my $oTestDef =
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
# Performance tests
|
||||||
|
{
|
||||||
|
&TESTDEF_NAME => 'performance',
|
||||||
|
|
||||||
|
&TESTDEF_TEST =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
&TESTDEF_NAME => 'archive',
|
||||||
|
&TESTDEF_TOTAL => 1,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
####################################################################################################################################
|
||||||
|
# Archive Performance Tests
|
||||||
|
####################################################################################################################################
|
||||||
|
package pgBackRestTest::Module::Performance::PerformanceArchiveTest;
|
||||||
|
use parent 'pgBackRestTest::Common::RunTest';
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
# Perl includes
|
||||||
|
####################################################################################################################################
|
||||||
|
use strict;
|
||||||
|
use warnings FATAL => qw(all);
|
||||||
|
use Carp qw(confess);
|
||||||
|
use English '-no_match_vars';
|
||||||
|
|
||||||
|
use Storable qw(dclone);
|
||||||
|
use Time::HiRes qw(gettimeofday);
|
||||||
|
|
||||||
|
use pgBackRest::Common::Log;
|
||||||
|
use pgBackRest::Config::Config;
|
||||||
|
|
||||||
|
use pgBackRestTest::Common::ExecuteTest;
|
||||||
|
use pgBackRestTest::Common::RunTest;
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
# initModule
|
||||||
|
####################################################################################################################################
|
||||||
|
sub initModule
|
||||||
|
{
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
$self->{strSpoolPath} = $self->testPath() . '/spool';
|
||||||
|
}
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
# initTest
|
||||||
|
####################################################################################################################################
|
||||||
|
sub initTest
|
||||||
|
{
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
# Create spool path
|
||||||
|
storageTest()->pathCreate($self->{strSpoolPath}, {bIgnoreExists => true, bCreateParent => true});
|
||||||
|
}
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
# run
|
||||||
|
####################################################################################################################################
|
||||||
|
sub run
|
||||||
|
{
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
################################################################################################################################
|
||||||
|
if ($self->begin("archive-push async (detect ok file)"))
|
||||||
|
{
|
||||||
|
#---------------------------------------------------------------------------------------------------------------------------
|
||||||
|
storageTest()->put(
|
||||||
|
storageTest()->openWrite(
|
||||||
|
'spool/archive/' . $self->stanza() . '/out/000000010000000100000001.ok', {bPathCreate => true}));
|
||||||
|
|
||||||
|
my $iRunTotal = 1;
|
||||||
|
my $lTimeBegin = gettimeofday();
|
||||||
|
|
||||||
|
for (my $iIndex = 0; $iIndex < $iRunTotal; $iIndex++)
|
||||||
|
{
|
||||||
|
executeTest(
|
||||||
|
$self->backrestExe() . ' --' . OPTION_STANZA . '=' . $self->stanza() . ' --' . OPTION_ARCHIVE_ASYNC .
|
||||||
|
' --' . OPTION_SPOOL_PATH . '=' . $self->{strSpoolPath} . ' --' . OPTION_ARCHIVE_TIMEOUT . '=1' .
|
||||||
|
' archive-push /pg_xlog/000000010000000100000001');
|
||||||
|
}
|
||||||
|
|
||||||
|
&log(INFO, 'time per execution: ' . ((gettimeofday() - $lTimeBegin) / $iRunTotal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Loading…
x
Reference in New Issue
Block a user