Skip to content

Commit 0781010

Browse files
Create a load testing EPP client (#2415)
* Create a load testing EPP client. This code is mostly based off of what was used for a past EPP load testing client that can be found in Google3 at https://source.corp.google.com/piper///depot/google3/experimental/users/jianglai/proxy/java/google/registry/proxy/client/ I modified the old client to be open-source friendly and use Gradle. For now, this only performs a login and logout command, I will further expand on this in later PRs to add other EPP commands so that we can truly load test the system. * Small changes * Remove unnecessary build dep * Add gradle build tasks * Small fixes * Add an instances setUp and cleanUp script * More modifications to instance setup scripts * change to ubuntu instance * Add comment to make ssh work
1 parent ab4bac0 commit 0781010

File tree

12 files changed

+759
-3
lines changed

12 files changed

+759
-3
lines changed

config/presubmits.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ def fails(self, file):
100100
{"node_modules/"}, REQUIRED):
101101
"Source files must end in a newline.",
102102

103-
# System.(out|err).println should only appear in tools/
103+
# System.(out|err).println should only appear in tools/ or load-testing/
104104
PresubmitCheck(
105105
r".*\bSystem\.(out|err)\.print", "java", {
106106
"StackdriverDashboardBuilder.java", "/tools/", "/example/",
107-
"RegistryTestServerMain.java", "TestServerExtension.java",
108-
"FlowDocumentationTool.java"
107+
"/load-testing/", "RegistryTestServerMain.java",
108+
"TestServerExtension.java", "FlowDocumentationTool.java"
109109
}):
110110
"System.(out|err).println is only allowed in tools/ packages. Please "
111111
"use a logger instead.",

load-testing/build.gradle

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2024 The Nomulus Authors. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
apply plugin: 'java'
16+
17+
createUberJar('buildLoadTestClient', 'loadTest', 'google.registry.client.EppClient')
18+
19+
dependencies {
20+
def deps = rootProject.dependencyMap
21+
implementation deps['joda-time:joda-time']
22+
implementation deps['io.netty:netty-buffer']
23+
implementation deps['io.netty:netty-codec']
24+
implementation deps['io.netty:netty-codec-http']
25+
implementation deps['io.netty:netty-common']
26+
implementation deps['io.netty:netty-handler']
27+
implementation deps['io.netty:netty-transport']
28+
implementation deps['com.google.guava:guava']
29+
implementation deps['org.bouncycastle:bcpg-jdk18on']
30+
implementation deps['org.bouncycastle:bcpkix-jdk18on']
31+
implementation deps['org.bouncycastle:bcprov-jdk18on']
32+
implementation deps['org.jcommander:jcommander']
33+
implementation deps['com.google.flogger:flogger']
34+
runtimeOnly deps['com.google.flogger:flogger-system-backend']
35+
}
36+
37+
task makeStagingDirectory {
38+
mkdir layout.buildDirectory.dir('stage')
39+
}
40+
41+
task copyFilesToStaging(dependsOn: makeStagingDirectory, type: Copy) {
42+
from layout.buildDirectory.file('libs/loadTest.jar'), "${projectDir}/certificate.pem", "${projectDir}/key.pem"
43+
into layout.buildDirectory.dir('stage')
44+
}
45+
46+
task deployLoadTestsToInstances (dependsOn: copyFilesToStaging, type: Exec) {
47+
executable "sh"
48+
workingDir "${projectDir}/"
49+
args "-c", "./deploy.sh"
50+
}
51+
52+
test {
53+
useJUnitPlatform()
54+
}

load-testing/deploy.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Copyright 2024 The Nomulus Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
HOSTS=$(gcloud compute instances list | awk '/^loadtest/ { print $5 }')
17+
for host in $HOSTS; do rsync -avz ./build/stage/ $host:test-client/; done

load-testing/instanceCleanUp.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Copyright 2024 The Nomulus Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Find and delete the instances used for load testing
17+
18+
gcloud compute instances list --filter="name ~ loadtest.*" --zones us-east4-a \
19+
--format="value(name)" | xargs gcloud compute instances delete --zone us-east4-a

load-testing/instanceSetUp.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
# Copyright 2024 The Nomulus Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Create the instances - modify this number for the amount of instances you
17+
# would like to use for your load test
18+
gcloud compute instances create loadtest-{1..2} --machine-type g1-small \
19+
--image-family ubuntu-2204-lts --image-project ubuntu-os-cloud --zone us-east4-a
20+
21+
sleep 10
22+
23+
# Get all the created load tests instances
24+
HOSTS=$(gcloud compute instances list | awk '/^loadtest/ { print $5 }')
25+
26+
#Install rsync and Java - Retry is needed here since ssh connection will fail until instances are fully provisioned
27+
for host in $HOSTS;
28+
do
29+
for i in {1..60}; do
30+
if ssh $host 'sudo apt-get -y update &&
31+
sudo apt-get -y upgrade &&
32+
sudo apt-get -y install rsync &&
33+
sudo apt-get -y install openjdk-21-jdk'; then
34+
break
35+
else
36+
sleep 5
37+
fi
38+
done
39+
done

load-testing/run.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Copyright 2024 The Nomulus Authors. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
HOSTS=$(gcloud compute instances list | awk '/^loadtest/ { print $5 }')
17+
18+
for host in $HOSTS;
19+
do ssh $host 'cd test-client/ &&
20+
java -jar loadTest.jar --host epp.example --certificate certificate.pem -k key.pem -pw examplePassword -ft';
21+
done

0 commit comments

Comments
 (0)