Skip to content
This repository was archived by the owner on Nov 2, 2022. It is now read-only.

Commit 0754549

Browse files
authored
Merge pull request #7 from steve-chavez/pgrst-rpc
postgrest: add RPC load tests and config for testing on t3a.nano..t3a.xlarge..c5.xlarge
2 parents 94922d5 + ce69334 commit 0754549

File tree

10 files changed

+344
-18
lines changed

10 files changed

+344
-18
lines changed

postgrest/deploy.nix

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,28 @@ in {
9898
};
9999
};
100100

101-
# Configuration
102-
t2nano = {resources, ...}: {
101+
t3anano = {resources, ...}: {
103102
deployment = {
104103
targetEnv = "ec2";
105104
ec2 = {
106105
inherit region accessKeyId;
107-
instanceType = "t2.nano";
106+
instanceType = "t3a.nano";
108107
associatePublicIpAddress = true;
109108
ebsInitialRootDiskSize = 10;
110109
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
111110
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
112111
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
113112
};
114113
};
114+
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1"; # Fix for https://github.com/NixOS/nixpkgs/issues/62824#issuecomment-516369379
115115
} // serverConf;
116116

117-
t3anano = {resources, ...}: {
117+
t3amicro = {resources, ...}: {
118118
deployment = {
119119
targetEnv = "ec2";
120120
ec2 = {
121121
inherit region accessKeyId;
122-
instanceType = "t3a.nano";
122+
instanceType = "t3a.micro";
123123
associatePublicIpAddress = true;
124124
ebsInitialRootDiskSize = 10;
125125
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
@@ -130,6 +130,69 @@ in {
130130
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1"; # Fix for https://github.com/NixOS/nixpkgs/issues/62824#issuecomment-516369379
131131
} // serverConf;
132132

133+
t3amedium = {resources, ...}: {
134+
deployment = {
135+
targetEnv = "ec2";
136+
ec2 = {
137+
inherit region accessKeyId;
138+
instanceType = "t3a.medium";
139+
associatePublicIpAddress = true;
140+
ebsInitialRootDiskSize = 10;
141+
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
142+
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
143+
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
144+
};
145+
};
146+
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1"; # Fix for https://github.com/NixOS/nixpkgs/issues/62824#issuecomment-516369379
147+
} // serverConf;
148+
149+
t3alarge = {resources, ...}: {
150+
deployment = {
151+
targetEnv = "ec2";
152+
ec2 = {
153+
inherit region accessKeyId;
154+
instanceType = "t3a.large";
155+
associatePublicIpAddress = true;
156+
ebsInitialRootDiskSize = 10;
157+
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
158+
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
159+
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
160+
};
161+
};
162+
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1";
163+
} // serverConf;
164+
165+
t3axlarge = {resources, ...}: {
166+
deployment = {
167+
targetEnv = "ec2";
168+
ec2 = {
169+
inherit region accessKeyId;
170+
instanceType = "t3a.xlarge";
171+
associatePublicIpAddress = true;
172+
ebsInitialRootDiskSize = 10;
173+
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
174+
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
175+
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
176+
};
177+
};
178+
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1";
179+
} // serverConf;
180+
181+
c5xlarge = {resources, ...}: {
182+
deployment = {
183+
targetEnv = "ec2";
184+
ec2 = {
185+
inherit region accessKeyId;
186+
instanceType = "c5.xlarge";
187+
associatePublicIpAddress = true;
188+
ebsInitialRootDiskSize = 10;
189+
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
190+
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
191+
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
192+
};
193+
};
194+
} // serverConf;
195+
133196
client = {nodes, resources, ...}: {
134197
environment.systemPackages = [
135198
pkgs.k6
@@ -152,9 +215,13 @@ in {
152215
{ domain = "root"; type = "hard"; item = "nofile"; value = "5000"; }
153216
{ domain = "root"; type = "soft"; item = "nofile"; value = "5000"; }
154217
];
155-
networking.hosts ={
156-
"${nodes.t2nano.config.networking.privateIPv4}" = [ "t2nano" ];
157-
"${nodes.t3anano.config.networking.privateIPv4}" = [ "t3anano" ];
218+
networking.hosts = {
219+
"${nodes.t3anano.config.networking.privateIPv4}" = [ "t3anano" ];
220+
"${nodes.t3amicro.config.networking.privateIPv4}" = [ "t3amicro" ];
221+
"${nodes.t3amedium.config.networking.privateIPv4}" = [ "t3amedium" ];
222+
"${nodes.t3alarge.config.networking.privateIPv4}" = [ "t3alarge" ];
223+
"${nodes.t3axlarge.config.networking.privateIPv4}" = [ "t3axlarge" ];
224+
"${nodes.c5xlarge.config.networking.privateIPv4}" = [ "c5xlarge" ];
158225
};
159226
};
160227
}

postgrest/k6/GETAllEmbed.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ import http from 'k6/http';
44

55
const URL = "http://" + __ENV.HOST;
66

7-
const RATE = (__ENV.HOST == 't2nano')? 40: 40;
7+
const RATE = (function(){
8+
if(__ENV.VERSION == 'v701'){
9+
switch(__ENV.HOST){
10+
case 'c5xlarge': return 70;
11+
case 't3axlarge': return 55;
12+
case 't3alarge': return 40;
13+
case 't3amedium': return 40;
14+
case 't3amicro': return 40;
15+
case 't3anano': return 40;
16+
default: return 40;
17+
}
18+
}
19+
else switch(__ENV.HOST){
20+
case 'c5xlarge': return 70;
21+
case 't3axlarge': return 65;
22+
case 't3alarge': return 40;
23+
case 't3amedium': return 40;
24+
case 't3amicro': return 40;
25+
case 't3anano': return 40;
26+
default: return 40;
27+
}
28+
})();
829

930
export let options = {
1031
discardResponseBodies: true,
@@ -13,7 +34,7 @@ export let options = {
1334
executor: 'constant-arrival-rate',
1435
rate: RATE,
1536
timeUnit: '1s',
16-
duration: '1m',
37+
duration: '30s',
1738
preAllocatedVUs: 100,
1839
maxVUs: 600,
1940
}

postgrest/k6/GETSingle.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ import http from 'k6/http';
44

55
const URL = "http://" + __ENV.HOST;
66

7-
const RATE = (__ENV.HOST == 't2nano')? 1100: 1400;
7+
const RATE = (function(){
8+
if(__ENV.VERSION == 'v701'){
9+
switch(__ENV.HOST){
10+
case 'c5xlarge': return 2400;
11+
case 't3axlarge': return 1600;
12+
case 't3alarge': return 1400;
13+
case 't3amedium': return 1400;
14+
case 't3amicro': return 1400;
15+
case 't3anano': return 1400;
16+
default: return 1000;
17+
}
18+
}
19+
else switch(__ENV.HOST){
20+
case 'c5xlarge': return 3000;
21+
case 't3axlarge': return 2300;
22+
case 't3alarge': return 2100;
23+
case 't3amedium': return 2100;
24+
case 't3amicro': return 2100;
25+
case 't3anano': return 2100;
26+
default: return 1000;
27+
}
28+
})();
829

930
export let options = {
1031
discardResponseBodies: true,
@@ -13,7 +34,7 @@ export let options = {
1334
executor: 'constant-arrival-rate',
1435
rate: RATE,
1536
timeUnit: '1s',
16-
duration: '1m',
37+
duration: '30s',
1738
preAllocatedVUs: 100,
1839
maxVUs: 600,
1940
}

postgrest/k6/GETSingleEmbed.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ import http from 'k6/http';
44

55
const URL = "http://" + __ENV.HOST;
66

7-
const RATE = (__ENV.HOST == 't2nano')? 500: 700;
7+
const RATE = (function(){
8+
if(__ENV.VERSION == 'v701'){
9+
switch(__ENV.HOST){
10+
case 'c5xlarge': return 1050;
11+
case 't3axlarge': return 800;
12+
case 't3alarge': return 500;
13+
case 't3amedium': return 500;
14+
case 't3amicro': return 500;
15+
case 't3anano': return 500;
16+
default: return 500;
17+
}
18+
}
19+
else switch(__ENV.HOST){
20+
case 'c5xlarge': return 1550;
21+
case 't3axlarge': return 1200;
22+
case 't3alarge': return 810;
23+
case 't3amedium': return 810;
24+
case 't3amicro': return 810;
25+
case 't3anano': return 810;
26+
default: return 500;
27+
}
28+
})();
829

930
export let options = {
1031
discardResponseBodies: true,
@@ -13,7 +34,7 @@ export let options = {
1334
executor: 'constant-arrival-rate',
1435
rate: RATE,
1536
timeUnit: '1s',
16-
duration: '1m',
37+
duration: '30s',
1738
preAllocatedVUs: 100,
1839
maxVUs: 600,
1940
}

postgrest/k6/POSTBulk.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ import http from 'k6/http';
44

55
const URL = "http://" + __ENV.HOST;
66

7-
const RATE = (__ENV.HOST === 't2nano')? 600: 600;
7+
const RATE = (function(){
8+
if(__ENV.VERSION == 'v701'){
9+
switch(__ENV.HOST){
10+
case 'c5xlarge': return 700;
11+
case 't3axlarge': return 600;
12+
case 't3alarge': return 600;
13+
case 't3amedium': return 600;
14+
case 't3amicro': return 600;
15+
case 't3anano': return 600;
16+
default: return 500;
17+
}
18+
}
19+
else switch(__ENV.HOST){
20+
case 'c5xlarge': return 700;
21+
case 't3axlarge': return 700;
22+
case 't3alarge': return 700;
23+
case 't3amedium': return 700;
24+
case 't3amicro': return 700;
25+
case 't3anano': return 700;
26+
default: return 500;
27+
}
28+
})();
829

930
export let options = {
1031
discardResponseBodies: true,
@@ -13,7 +34,7 @@ export let options = {
1334
executor: 'constant-arrival-rate',
1435
rate: RATE,
1536
timeUnit: '1s',
16-
duration: '1m',
37+
duration: '30s',
1738
preAllocatedVUs: 100,
1839
maxVUs: 600,
1940
}

postgrest/k6/POSTSingle.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ import http from 'k6/http';
44

55
const URL = "http://" + __ENV.HOST;
66

7-
const RATE = (__ENV.HOST === 't2nano')? 1000: 1300;
7+
const RATE = (function(){
8+
if(__ENV.VERSION == 'v701'){
9+
switch(__ENV.HOST){
10+
case 'c5xlarge': return 1500;
11+
case 't3axlarge': return 1300;
12+
case 't3alarge': return 1300;
13+
case 't3amedium': return 1300;
14+
case 't3amicro': return 1300;
15+
case 't3anano': return 1300;
16+
default: return 1000;
17+
}
18+
}
19+
else switch(__ENV.HOST){
20+
case 'c5xlarge': return 1600;
21+
case 't3axlarge': return 1600;
22+
case 't3alarge': return 1600;
23+
case 't3amedium': return 1600;
24+
case 't3amicro': return 1600;
25+
case 't3anano': return 1600;
26+
default: return 1000;
27+
}
28+
})();
829

930
export let options = {
1031
discardResponseBodies: true,
@@ -13,7 +34,7 @@ export let options = {
1334
executor: 'constant-arrival-rate',
1435
rate: RATE,
1536
timeUnit: '1s',
16-
duration: '1m',
37+
duration: '30s',
1738
preAllocatedVUs: 100,
1839
maxVUs: 600,
1940
}

postgrest/k6/RPCGETSingle.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { Rate } from "k6/metrics";
2+
import { check, group, sleep } from 'k6';
3+
import http from 'k6/http';
4+
5+
const URL = "http://" + __ENV.HOST;
6+
7+
const RATE = (function(){
8+
if(__ENV.VERSION == 'v701'){
9+
switch(__ENV.HOST){
10+
case 'c5xlarge': return 2400;
11+
case 't3axlarge': return 1600;
12+
case 't3anano': return 1500;
13+
default: return 1000;
14+
}
15+
}
16+
else switch(__ENV.HOST){
17+
case 'c5xlarge': return 3000;
18+
case 't3axlarge': return 2300;
19+
case 't3anano': return 2200;
20+
default: return 1000;
21+
}
22+
})();
23+
24+
export let options = {
25+
discardResponseBodies: true,
26+
scenarios: {
27+
constant_request_rate: {
28+
executor: 'constant-arrival-rate',
29+
rate: RATE,
30+
timeUnit: '1s',
31+
duration: '30s',
32+
preAllocatedVUs: 100,
33+
maxVUs: 600,
34+
}
35+
},
36+
thresholds: {
37+
'failed requests': ['rate<0.1'],
38+
'http_req_duration': ['p(95)<1000']
39+
}
40+
};
41+
42+
const myFailRate = new Rate('failed requests');
43+
44+
export default function() {
45+
let res = http.get(URL + "/rpc/ret_artists?select=*&artist_id=eq.3");
46+
myFailRate.add(res.status !== 200);
47+
}

0 commit comments

Comments
 (0)