mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 05:55:28 +00:00
[github36] Another bunch of changes after review:
- using namespace cleaned up - all host benchmarks are now commented - common parameters moved to parameters.h - code wrapping fixed
This commit is contained in:
@@ -23,6 +23,7 @@ run_benchmarks_SOURCES = run_benchmarks.cc
|
||||
run_benchmarks_SOURCES += generic_lease_mgr_benchmark.cc generic_lease_mgr_benchmark.h
|
||||
run_benchmarks_SOURCES += generic_host_data_source_benchmark.cc generic_host_data_source_benchmark.h
|
||||
run_benchmarks_SOURCES += memfile_lease_mgr_benchmark.cc
|
||||
run_benchmarks_SOURCES += parameters.h
|
||||
|
||||
if HAVE_MYSQL
|
||||
run_benchmarks_SOURCES += mysql_lease_mgr_benchmark.cc
|
||||
|
@@ -18,18 +18,16 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/host_data_source_factory.h>
|
||||
#include <dhcpsrv/testutils/cql_schema.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using isc::dhcp::bench::GenericHostDataSourceBenchmark;
|
||||
using isc::dhcp::test::createCqlSchema;
|
||||
using isc::dhcp::test::destroyCqlSchema;
|
||||
using isc::dhcp::HostDataSourceFactory;
|
||||
using isc::dhcp::test::validCqlConnectionString;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using namespace isc::dhcp::bench;
|
||||
using namespace isc::dhcp::test;
|
||||
using namespace isc::dhcp;
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -164,21 +162,64 @@ BENCHMARK_DEFINE_F(CqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& sta
|
||||
}
|
||||
}
|
||||
|
||||
constexpr size_t MIN_HOST_COUNT = 512;
|
||||
constexpr size_t MAX_HOST_COUNT = 0xfffd;
|
||||
constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts insertion.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, insertHosts)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, insertHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, updateHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllByHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAll)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllv4Resv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6Prefix)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts update.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, updateHosts)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll(hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllByHWAddrDuid)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll4(hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAll)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll(v4-reservation) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, getAllv4Resv)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4IdentifierSubnetId)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, v4-reservation) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6IdentifierSubnetId)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, ip-address) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6SubnetIdAddr)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(ip-prefix, prefix-len) call.
|
||||
BENCHMARK_REGISTER_F(CqlHostDataSourceBenchmark, get6Prefix)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
} // namespace
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/lease_mgr_factory.h>
|
||||
#include <dhcpsrv/testutils/cql_schema.h>
|
||||
|
||||
|
@@ -130,32 +130,22 @@ GenericHostDataSourceBenchmark::addTestOptions(const HostPtr& host, const bool f
|
||||
// Add DHCPv6 options.
|
||||
CfgOptionPtr opts = host->getCfgOption6();
|
||||
opts->add(createOption<OptionString>(Option::V6, D6O_BOOTFILE_URL, true,
|
||||
formatted, "my-boot-file"),
|
||||
DHCP6_OPTION_SPACE);
|
||||
opts->add(createOption<OptionUint32>(Option::V6,
|
||||
D6O_INFORMATION_REFRESH_TIME,
|
||||
false, formatted, 3600),
|
||||
DHCP6_OPTION_SPACE);
|
||||
opts->add(createVendorOption(Option::V6, false, formatted, 2495),
|
||||
DHCP6_OPTION_SPACE);
|
||||
opts->add(createAddressOption<Option6AddrLst>(1024, false, formatted,
|
||||
"2001:db8:1::1"),
|
||||
formatted, "my-boot-file"), DHCP6_OPTION_SPACE);
|
||||
opts->add(createOption<OptionUint32>(Option::V6, D6O_INFORMATION_REFRESH_TIME,
|
||||
false, formatted, 3600), DHCP6_OPTION_SPACE);
|
||||
opts->add(createVendorOption(Option::V6, false, formatted, 2495), DHCP6_OPTION_SPACE);
|
||||
opts->add(createAddressOption<Option6AddrLst>(1024, false, formatted, "2001:db8:1::1"),
|
||||
DHCP6_OPTION_SPACE);
|
||||
opts->add(createEmptyOption(Option::V6, 1, true), "isc2");
|
||||
opts->add(createAddressOption<Option6AddrLst>(
|
||||
2, false, formatted, "3000::1", "3000::2", "3000::3"),
|
||||
"isc2");
|
||||
opts->add(createAddressOption<Option6AddrLst>(2, false, formatted, "3000::1", "3000::2",
|
||||
"3000::3"), "isc2");
|
||||
|
||||
// Add definitions for DHCPv6 non-standard options.
|
||||
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
|
||||
"option-1024", 1024, "ipv6-address", true)),
|
||||
DHCP6_OPTION_SPACE);
|
||||
defs.addItem(
|
||||
OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")),
|
||||
"isc2");
|
||||
defs.addItem(OptionDefinitionPtr(new OptionDefinition(
|
||||
"option-2", 2, "ipv6-address", true)),
|
||||
"isc2");
|
||||
defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1024", 1024, "ipv6-address",
|
||||
true)), DHCP6_OPTION_SPACE);
|
||||
defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-1", 1, "empty")), "isc2");
|
||||
defs.addItem(OptionDefinitionPtr(new OptionDefinition("option-2", 2, "ipv6-address",
|
||||
true)), "isc2");
|
||||
}
|
||||
|
||||
// Register created "runtime" option definitions. They will be used by a
|
||||
@@ -226,9 +216,8 @@ void
|
||||
GenericHostDataSourceBenchmark::benchGet4BySubnetHWAddrDuid() {
|
||||
for (HostPtr host : hosts_) {
|
||||
std::vector<uint8_t> hwaddr = host->getIdentifier();
|
||||
hdsptr_->get4(host->getIPv4SubnetID(),
|
||||
HWAddrPtr(new HWAddr(hwaddr, host->getIdentifierType())),
|
||||
host->getDuid());
|
||||
hdsptr_->get4(host->getIPv4SubnetID(), HWAddrPtr(new HWAddr(hwaddr,
|
||||
host->getIdentifierType())), host->getDuid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ namespace isc {
|
||||
namespace dhcp {
|
||||
namespace bench {
|
||||
|
||||
/// @brief Base fixture class for benchmarking host bakcends.
|
||||
/// @brief Base fixture class for benchmarking host bakcends.
|
||||
class GenericHostDataSourceBenchmark : public ::benchmark::Fixture {
|
||||
public:
|
||||
|
||||
@@ -188,22 +188,36 @@ public:
|
||||
/// getAll(identifier-type, identifier) call.
|
||||
void benchGetAll();
|
||||
|
||||
/// @brief Essential stpes requires to benchmark host reservation retrieval
|
||||
/// @brief Essential steps required to benchmark host reservation retrieval
|
||||
/// using getAll(ipv4-reservation) call.
|
||||
void getAllv4Resv();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using getAll(hw-addr, duid) call.
|
||||
void benchGet4BySubnetHWAddrDuid();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using getAll(identifier-type, identifier, subnet-id) call.
|
||||
void benchGet4IdentifierSubnetId();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using getAll(v4-reservation) call.
|
||||
void benchGet4SubnetIdv4Resrv();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using get6(subnet-id, duid, hw-addr) call.
|
||||
void benchGet6SubnetIdDuidHWAddr();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using get6(identifier-type, identifier, subnet-id) call.
|
||||
void benchGet6IdentifierSubnetId();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using get6(ip-addr, subnet-id) call.
|
||||
void benchGet6SubnetIdAddr();
|
||||
|
||||
/// @brief Essential steps requires to benchmark host reservation retrieval
|
||||
/// using get6(prefix, len) call.
|
||||
void benchGet6Prefix();
|
||||
|
||||
/// Pointer to the host backend being benchmarked
|
||||
|
@@ -26,23 +26,6 @@ namespace isc {
|
||||
namespace dhcp {
|
||||
namespace bench {
|
||||
|
||||
/// @defgroup memfile_params Benchmark parameters that define boundary values
|
||||
/// for benchmarks.
|
||||
///
|
||||
/// The range is defined as 512..65533. Google benchmark will pick a few specifc
|
||||
/// values: 512, 4096, 32768, 65533.
|
||||
|
||||
/// @{
|
||||
|
||||
/// @brief A minimum number of leases used in a benchmark
|
||||
constexpr size_t MIN_LEASE_COUNT = 512;
|
||||
/// @brief A maximum number of leases used in a benchmark
|
||||
constexpr size_t MAX_LEASE_COUNT = 0xfffd;
|
||||
/// @brief A time unit used - all results to be expressed in us (microseconds)
|
||||
constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
|
||||
|
||||
/// @}
|
||||
|
||||
/// @brief A base class for a fixture for specific lease manager benchmarks
|
||||
class GenericLeaseMgrBenchmark : public benchmark::Fixture {
|
||||
public:
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/memfile_lease_mgr.h>
|
||||
#include <dhcpsrv/lease_mgr_factory.h>
|
||||
#include <dhcpsrv/testutils/lease_file_io.h>
|
||||
@@ -14,8 +15,6 @@
|
||||
using namespace isc::dhcp;
|
||||
using namespace isc::dhcp::test;
|
||||
using namespace isc::dhcp::bench;
|
||||
using isc::dhcp::LeaseMgrFactory;
|
||||
using isc::dhcp::bench::GenericLeaseMgrBenchmark;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@@ -17,23 +17,26 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/host_data_source_factory.h>
|
||||
#include <dhcpsrv/testutils/mysql_schema.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using isc::dhcp::bench::GenericHostDataSourceBenchmark;
|
||||
using isc::dhcp::test::createMySQLSchema;
|
||||
using isc::dhcp::test::destroyMySQLSchema;
|
||||
using isc::dhcp::HostDataSourceFactory;
|
||||
using isc::dhcp::test::validMySQLConnectionString;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using namespace isc::dhcp::bench;
|
||||
using namespace isc::dhcp::test;
|
||||
using namespace isc::dhcp;
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
/// @brief This is a fixture class used for benchmarking MySQL host backend
|
||||
class MySqlHostDataSourceBenchmark : public GenericHostDataSourceBenchmark {
|
||||
public:
|
||||
|
||||
/// @brief Setup routine.
|
||||
///
|
||||
/// It cleans up schema and recreates tables, then instantiates LeaseMgr
|
||||
void SetUp(::benchmark::State const&) override {
|
||||
destroyMySQLSchema(false);
|
||||
createMySQLSchema(false);
|
||||
@@ -47,6 +50,7 @@ public:
|
||||
hdsptr_ = HostDataSourceFactory::getHostDataSourcePtr();
|
||||
}
|
||||
|
||||
/// @brief Cleans up after the test.
|
||||
void TearDown(::benchmark::State const&) override {
|
||||
try {
|
||||
hdsptr_->rollback();
|
||||
@@ -60,6 +64,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts insertion.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, insertHosts)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -68,6 +74,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, insertHosts)(benchmark::State&
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts update.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, updateHosts)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -76,6 +84,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, updateHosts)(benchmark::State&
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by getAll(hw-addr, duid) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, getAllByHWAddrDuid)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -84,6 +94,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, getAllByHWAddrDuid)(benchmark::
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by getAll4(hw-addr, duid) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, getAll)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -92,6 +104,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, getAll)(benchmark::State& state
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by getAll(v4-reservation) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, getAllv4Resv)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -100,6 +114,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, getAllv4Resv)(benchmark::State&
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -108,6 +124,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)(benchma
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get4IdentifierSubnetId)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -116,6 +134,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get4IdentifierSubnetId)(benchma
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, v4-reservation) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -124,6 +144,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)(benchmark:
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -132,6 +154,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)(benchma
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6IdentifierSubnetId)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -140,6 +164,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6IdentifierSubnetId)(benchma
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, ip-address) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6SubnetIdAddr)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -148,6 +174,8 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6SubnetIdAddr)(benchmark::St
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines steps necessary for conducting a benchmark that measures
|
||||
/// hosts retrieval by get6(ip-prefix, prefix-len) call.
|
||||
BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& state) {
|
||||
const size_t host_count = state.range(0);
|
||||
while (state.KeepRunning()) {
|
||||
@@ -156,21 +184,64 @@ BENCHMARK_DEFINE_F(MySqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& s
|
||||
}
|
||||
}
|
||||
|
||||
constexpr size_t MIN_HOST_COUNT = 512;
|
||||
constexpr size_t MAX_HOST_COUNT = 0xfffd;
|
||||
constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts insertion.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, insertHosts)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, insertHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, updateHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllByHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAll)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllv4Resv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6Prefix)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts update.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, updateHosts)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll(hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllByHWAddrDuid)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll4(hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAll)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll(v4-reservation) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, getAllv4Resv)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4IdentifierSubnetId)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, v4-reservation) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6IdentifierSubnetId)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, ip-address) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6SubnetIdAddr)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(ip-prefix, prefix-len) call.
|
||||
BENCHMARK_REGISTER_F(MySqlHostDataSourceBenchmark, get6Prefix)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
} // namespace
|
||||
|
@@ -17,14 +17,14 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/lease_mgr_factory.h>
|
||||
#include <dhcpsrv/testutils/mysql_schema.h>
|
||||
|
||||
using namespace isc::dhcp::bench;
|
||||
using namespace isc::dhcp::test;
|
||||
using namespace isc::dhcp;
|
||||
using namespace std;
|
||||
using isc::dhcp::LeaseMgrFactory;
|
||||
//using isc::dhcp::bench::GenericLeaseMgrBenchmark;
|
||||
|
||||
namespace {
|
||||
|
||||
|
43
src/lib/dhcpsrv/benchmarks/parameters.h
Normal file
43
src/lib/dhcpsrv/benchmarks/parameters.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#ifndef BENCHMARKS_PARAMETERS_H
|
||||
#define BENCHMARKS_PARAMETERS_H
|
||||
|
||||
#include <benchmark/benchmark.h>
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
namespace bench {
|
||||
|
||||
/// @defgroup benchmark_params Benchmark parameters that define boundary values
|
||||
/// for benchmarks.
|
||||
///
|
||||
/// The range is defined as 512..65533. Google benchmark will pick a few specifc
|
||||
/// values: 512, 4096, 32768, 65533.
|
||||
|
||||
/// @{
|
||||
|
||||
/// @brief A minimum number of leases used in a benchmark
|
||||
constexpr size_t MIN_LEASE_COUNT = 512;
|
||||
/// @brief A maximum number of leases used in a benchmark
|
||||
constexpr size_t MAX_LEASE_COUNT = 0xfffd;
|
||||
|
||||
/// @brief A minimum number of leases used in a benchmark
|
||||
constexpr size_t MIN_HOST_COUNT = 512;
|
||||
/// @brief A maximum number of leases used in a benchmark
|
||||
constexpr size_t MAX_HOST_COUNT = 0xfffd;
|
||||
|
||||
/// @brief A time unit used - all results to be expressed in us (microseconds)
|
||||
constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
|
||||
|
||||
/// @}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@@ -17,18 +17,15 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_host_data_source_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/host_data_source_factory.h>
|
||||
#include <dhcpsrv/testutils/pgsql_schema.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using isc::dhcp::bench::GenericHostDataSourceBenchmark;
|
||||
using isc::dhcp::test::createPgSQLSchema;
|
||||
using isc::dhcp::test::destroyPgSQLSchema;
|
||||
using isc::dhcp::HostDataSourceFactory;
|
||||
using isc::dhcp::test::validPgSQLConnectionString;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using namespace isc::dhcp::bench;
|
||||
using namespace isc::dhcp::test;
|
||||
using namespace isc::dhcp;
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -156,21 +153,64 @@ BENCHMARK_DEFINE_F(PgSqlHostDataSourceBenchmark, get6Prefix)(benchmark::State& s
|
||||
}
|
||||
}
|
||||
|
||||
constexpr size_t MIN_HOST_COUNT = 512;
|
||||
constexpr size_t MAX_HOST_COUNT = 0xfffd;
|
||||
constexpr benchmark::TimeUnit UNIT = benchmark::kMicrosecond;
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts insertion.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, insertHosts)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, insertHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, updateHosts)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllByHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAll)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllv4Resv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6IdentifierSubnetId)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdAddr)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6Prefix)->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts update.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, updateHosts)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll(hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllByHWAddrDuid)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll4(hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAll)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by getAll(v4-reservation) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, getAllv4Resv)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, hw-addr, duid) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4BySubnetHWAddrDuid)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(identifier-type, identifier, subnet-id) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4IdentifierSubnetId)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get4(subnet-id, v4-reservation) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get4SubnetIdv4Resrv)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, duid, hw-addr) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdDuidHWAddr)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, identifier-type, identifier) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6IdentifierSubnetId)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(subnet-id, ip-address) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6SubnetIdAddr)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
/// Defines parameters necessary for running a benchmark that measures
|
||||
/// hosts retrieval by get6(ip-prefix, prefix-len) call.
|
||||
BENCHMARK_REGISTER_F(PgSqlHostDataSourceBenchmark, get6Prefix)
|
||||
->Range(MIN_HOST_COUNT, MAX_HOST_COUNT)->Unit(UNIT);
|
||||
|
||||
} // namespace
|
||||
|
@@ -18,17 +18,14 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcpsrv/benchmarks/generic_lease_mgr_benchmark.h>
|
||||
#include <dhcpsrv/benchmarks/parameters.h>
|
||||
#include <dhcpsrv/lease_mgr_factory.h>
|
||||
#include <dhcpsrv/testutils/pgsql_schema.h>
|
||||
|
||||
using namespace isc::dhcp::bench;
|
||||
using isc::dhcp::LeaseMgrFactory;
|
||||
using isc::dhcp::bench::GenericLeaseMgrBenchmark;
|
||||
using isc::dhcp::test::createPgSQLSchema;
|
||||
using isc::dhcp::test::destroyPgSQLSchema;
|
||||
using isc::dhcp::test::validPgSQLConnectionString;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using namespace isc::dhcp;
|
||||
using namespace isc::dhcp::test;
|
||||
using namespace std;
|
||||
|
||||
namespace {
|
||||
|
||||
|
Reference in New Issue
Block a user