Skip to content

Commit

Permalink
1. Support running sql server 2019 on GCP.
Browse files Browse the repository at this point in the history
2. Support running Hammerdb TPCC with Windows client on Azure

PiperOrigin-RevId: 565551552
  • Loading branch information
raymond13513 authored and copybara-github committed Sep 15, 2023
1 parent 122695e commit 4c36efd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion perfkitbenchmarker/providers/azure/azure_relational_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def _CreateSqlServerInstance(self):
'--zone-redundant',
'true' if self.spec.high_availability else 'false'
]
vm_util.IssueCommand(cmd)
vm_util.IssueCommand(cmd, timeout=CREATE_AZURE_DB_TIMEOUT)
self.database_name = DEFAULT_DATABASE_NAME

def _CreateAzureManagedSqlInstance(self):
Expand Down
4 changes: 4 additions & 0 deletions perfkitbenchmarker/providers/gcp/gcp_relational_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
'2017_Enterprise': 'SQLSERVER_2017_ENTERPRISE',
'2017_Express': 'SQLSERVER_2017_EXPRESS',
'2017_Web': 'SQLSERVER_2017_WEB',
'2019_Standard': 'SQLSERVER_2019_Standard',
'2019_Enterprise': 'SQLSERVER_2019_ENTERPRISE',
'2019_Express': 'SQLSERVER_2019_EXPRESS',
'2019_Web': 'SQLSERVER_2019_WEB',
},
}

Expand Down
18 changes: 14 additions & 4 deletions perfkitbenchmarker/windows_benchmarks/hammerdbcli_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,20 @@ def Prepare(benchmark_spec):
relational_db = benchmark_spec.relational_db
vm = relational_db.client_vm
vm.Install('hammerdb')
hammerdb.SetupConfig(vm, sql_engine_utils.SQLSERVER,
hammerdb.HAMMERDB_SCRIPT.value, relational_db.endpoint,
relational_db.port, relational_db.spec.database_password,
relational_db.spec.database_username, False)
is_azure = FLAGS.cloud == 'Azure' and FLAGS.use_managed_db
if is_azure and hammerdb.HAMMERDB_SCRIPT.value == 'tpc_c':
# Create the database first only Azure requires creating the database.
relational_db.client_vm_query_tools.IssueSqlCommand('CREATE DATABASE tpcc;')
hammerdb.SetupConfig(
vm,
sql_engine_utils.SQLSERVER,
hammerdb.HAMMERDB_SCRIPT.value,
relational_db.endpoint,
relational_db.port,
relational_db.spec.database_password,
relational_db.spec.database_username,
is_azure,
)


def SetMinimumRecover(relational_db):
Expand Down
20 changes: 11 additions & 9 deletions perfkitbenchmarker/windows_packages/hammerdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@

# import linux flags
HAMMERDB_SCRIPT = linux_hammerdb.HAMMERDB_SCRIPT
HAMMERDB_OPTIMIZED_SERVER_CONFIGURATION = linux_hammerdb.HAMMERDB_OPTIMIZED_SERVER_CONFIGURATION
HAMMERDB_OPTIMIZED_SERVER_CONFIGURATION = (
linux_hammerdb.HAMMERDB_OPTIMIZED_SERVER_CONFIGURATION
)
NON_OPTIMIZED = linux_hammerdb.NON_OPTIMIZED
MINIMUM_RECOVERY = linux_hammerdb.MINIMUM_RECOVERY

# Default run timeout
EIGHT_HOURS = 60*60*8
TIMEOUT = 60 * 60 * 20


class WindowsHammerDbTclScript(linux_hammerdb.HammerDbTclScript):
Expand All @@ -59,10 +61,11 @@ def Run(self, vm, timeout: Optional[int] = 60*60*6) -> str:
"""Run hammerdbcli script."""
hammerdb_exe_dir = ntpath.join(
vm.temp_dir, HAMMERDB.format(linux_hammerdb.HAMMERDB_VERSION.value))
stdout, _ = vm.RemoteCommand(
stdout, _ = vm.RobustRemoteCommand(
f'cd {hammerdb_exe_dir} ; '
f'.\\hammerdbcli.bat auto {self.tcl_script_name}',
timeout=timeout)
timeout=timeout,
)

self.CheckErrorFromHammerdb(stdout)
return stdout
Expand Down Expand Up @@ -166,13 +169,12 @@ def SetupConfig(vm, db_engine: str, hammerdb_script: str, ip: str, port: int,
# Run all the build script or scripts before actual run phase
for script in windows_scripts:
if script.script_type == linux_hammerdb.BUILD_SCRIPT_TYPE:
script.Run(vm)
script.Run(vm, timeout=TIMEOUT)


def Run(vm,
db_engine: str,
hammerdb_script: str,
timeout: Optional[int] = EIGHT_HOURS) -> List[sample.Sample]:
def Run(
vm, db_engine: str, hammerdb_script: str, timeout: Optional[int] = TIMEOUT
) -> List[sample.Sample]:
"""Run the HammerDB Benchmark.
Runs Hammerdb TPCC or TPCH script.
Expand Down

0 comments on commit 4c36efd

Please sign in to comment.