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

Commit

Permalink
Merge pull request #7 from steve-chavez/pgrst-rpc
Browse files Browse the repository at this point in the history
postgrest: add RPC load tests and config for testing on t3a.nano..t3a.xlarge..c5.xlarge
  • Loading branch information
kiwicopple authored Oct 31, 2020
2 parents 94922d5 + ce69334 commit 0754549
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 18 deletions.
83 changes: 75 additions & 8 deletions postgrest/deploy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,28 @@ in {
};
};

# Configuration
t2nano = {resources, ...}: {
t3anano = {resources, ...}: {
deployment = {
targetEnv = "ec2";
ec2 = {
inherit region accessKeyId;
instanceType = "t2.nano";
instanceType = "t3a.nano";
associatePublicIpAddress = true;
ebsInitialRootDiskSize = 10;
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
};
};
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1"; # Fix for https://github.com/NixOS/nixpkgs/issues/62824#issuecomment-516369379
} // serverConf;

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

t3amedium = {resources, ...}: {
deployment = {
targetEnv = "ec2";
ec2 = {
inherit region accessKeyId;
instanceType = "t3a.medium";
associatePublicIpAddress = true;
ebsInitialRootDiskSize = 10;
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
};
};
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1"; # Fix for https://github.com/NixOS/nixpkgs/issues/62824#issuecomment-516369379
} // serverConf;

t3alarge = {resources, ...}: {
deployment = {
targetEnv = "ec2";
ec2 = {
inherit region accessKeyId;
instanceType = "t3a.large";
associatePublicIpAddress = true;
ebsInitialRootDiskSize = 10;
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
};
};
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1";
} // serverConf;

t3axlarge = {resources, ...}: {
deployment = {
targetEnv = "ec2";
ec2 = {
inherit region accessKeyId;
instanceType = "t3a.xlarge";
associatePublicIpAddress = true;
ebsInitialRootDiskSize = 10;
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
};
};
boot.loader.grub.device = pkgs.lib.mkForce "/dev/nvme0n1";
} // serverConf;

c5xlarge = {resources, ...}: {
deployment = {
targetEnv = "ec2";
ec2 = {
inherit region accessKeyId;
instanceType = "c5.xlarge";
associatePublicIpAddress = true;
ebsInitialRootDiskSize = 10;
keyPair = resources.ec2KeyPairs.pgrstBenchKeyPair;
subnetId = resources.vpcSubnets.pgrstBenchSubnet;
securityGroupIds = [resources.ec2SecurityGroups.pgrstBenchSecGroup.name];
};
};
} // serverConf;

client = {nodes, resources, ...}: {
environment.systemPackages = [
pkgs.k6
Expand All @@ -152,9 +215,13 @@ in {
{ domain = "root"; type = "hard"; item = "nofile"; value = "5000"; }
{ domain = "root"; type = "soft"; item = "nofile"; value = "5000"; }
];
networking.hosts ={
"${nodes.t2nano.config.networking.privateIPv4}" = [ "t2nano" ];
"${nodes.t3anano.config.networking.privateIPv4}" = [ "t3anano" ];
networking.hosts = {
"${nodes.t3anano.config.networking.privateIPv4}" = [ "t3anano" ];
"${nodes.t3amicro.config.networking.privateIPv4}" = [ "t3amicro" ];
"${nodes.t3amedium.config.networking.privateIPv4}" = [ "t3amedium" ];
"${nodes.t3alarge.config.networking.privateIPv4}" = [ "t3alarge" ];
"${nodes.t3axlarge.config.networking.privateIPv4}" = [ "t3axlarge" ];
"${nodes.c5xlarge.config.networking.privateIPv4}" = [ "c5xlarge" ];
};
};
}
25 changes: 23 additions & 2 deletions postgrest/k6/GETAllEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ import http from 'k6/http';

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

const RATE = (__ENV.HOST == 't2nano')? 40: 40;
const RATE = (function(){
if(__ENV.VERSION == 'v701'){
switch(__ENV.HOST){
case 'c5xlarge': return 70;
case 't3axlarge': return 55;
case 't3alarge': return 40;
case 't3amedium': return 40;
case 't3amicro': return 40;
case 't3anano': return 40;
default: return 40;
}
}
else switch(__ENV.HOST){
case 'c5xlarge': return 70;
case 't3axlarge': return 65;
case 't3alarge': return 40;
case 't3amedium': return 40;
case 't3amicro': return 40;
case 't3anano': return 40;
default: return 40;
}
})();

export let options = {
discardResponseBodies: true,
Expand All @@ -13,7 +34,7 @@ export let options = {
executor: 'constant-arrival-rate',
rate: RATE,
timeUnit: '1s',
duration: '1m',
duration: '30s',
preAllocatedVUs: 100,
maxVUs: 600,
}
Expand Down
25 changes: 23 additions & 2 deletions postgrest/k6/GETSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ import http from 'k6/http';

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

const RATE = (__ENV.HOST == 't2nano')? 1100: 1400;
const RATE = (function(){
if(__ENV.VERSION == 'v701'){
switch(__ENV.HOST){
case 'c5xlarge': return 2400;
case 't3axlarge': return 1600;
case 't3alarge': return 1400;
case 't3amedium': return 1400;
case 't3amicro': return 1400;
case 't3anano': return 1400;
default: return 1000;
}
}
else switch(__ENV.HOST){
case 'c5xlarge': return 3000;
case 't3axlarge': return 2300;
case 't3alarge': return 2100;
case 't3amedium': return 2100;
case 't3amicro': return 2100;
case 't3anano': return 2100;
default: return 1000;
}
})();

export let options = {
discardResponseBodies: true,
Expand All @@ -13,7 +34,7 @@ export let options = {
executor: 'constant-arrival-rate',
rate: RATE,
timeUnit: '1s',
duration: '1m',
duration: '30s',
preAllocatedVUs: 100,
maxVUs: 600,
}
Expand Down
25 changes: 23 additions & 2 deletions postgrest/k6/GETSingleEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ import http from 'k6/http';

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

const RATE = (__ENV.HOST == 't2nano')? 500: 700;
const RATE = (function(){
if(__ENV.VERSION == 'v701'){
switch(__ENV.HOST){
case 'c5xlarge': return 1050;
case 't3axlarge': return 800;
case 't3alarge': return 500;
case 't3amedium': return 500;
case 't3amicro': return 500;
case 't3anano': return 500;
default: return 500;
}
}
else switch(__ENV.HOST){
case 'c5xlarge': return 1550;
case 't3axlarge': return 1200;
case 't3alarge': return 810;
case 't3amedium': return 810;
case 't3amicro': return 810;
case 't3anano': return 810;
default: return 500;
}
})();

export let options = {
discardResponseBodies: true,
Expand All @@ -13,7 +34,7 @@ export let options = {
executor: 'constant-arrival-rate',
rate: RATE,
timeUnit: '1s',
duration: '1m',
duration: '30s',
preAllocatedVUs: 100,
maxVUs: 600,
}
Expand Down
25 changes: 23 additions & 2 deletions postgrest/k6/POSTBulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ import http from 'k6/http';

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

const RATE = (__ENV.HOST === 't2nano')? 600: 600;
const RATE = (function(){
if(__ENV.VERSION == 'v701'){
switch(__ENV.HOST){
case 'c5xlarge': return 700;
case 't3axlarge': return 600;
case 't3alarge': return 600;
case 't3amedium': return 600;
case 't3amicro': return 600;
case 't3anano': return 600;
default: return 500;
}
}
else switch(__ENV.HOST){
case 'c5xlarge': return 700;
case 't3axlarge': return 700;
case 't3alarge': return 700;
case 't3amedium': return 700;
case 't3amicro': return 700;
case 't3anano': return 700;
default: return 500;
}
})();

export let options = {
discardResponseBodies: true,
Expand All @@ -13,7 +34,7 @@ export let options = {
executor: 'constant-arrival-rate',
rate: RATE,
timeUnit: '1s',
duration: '1m',
duration: '30s',
preAllocatedVUs: 100,
maxVUs: 600,
}
Expand Down
25 changes: 23 additions & 2 deletions postgrest/k6/POSTSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ import http from 'k6/http';

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

const RATE = (__ENV.HOST === 't2nano')? 1000: 1300;
const RATE = (function(){
if(__ENV.VERSION == 'v701'){
switch(__ENV.HOST){
case 'c5xlarge': return 1500;
case 't3axlarge': return 1300;
case 't3alarge': return 1300;
case 't3amedium': return 1300;
case 't3amicro': return 1300;
case 't3anano': return 1300;
default: return 1000;
}
}
else switch(__ENV.HOST){
case 'c5xlarge': return 1600;
case 't3axlarge': return 1600;
case 't3alarge': return 1600;
case 't3amedium': return 1600;
case 't3amicro': return 1600;
case 't3anano': return 1600;
default: return 1000;
}
})();

export let options = {
discardResponseBodies: true,
Expand All @@ -13,7 +34,7 @@ export let options = {
executor: 'constant-arrival-rate',
rate: RATE,
timeUnit: '1s',
duration: '1m',
duration: '30s',
preAllocatedVUs: 100,
maxVUs: 600,
}
Expand Down
47 changes: 47 additions & 0 deletions postgrest/k6/RPCGETSingle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Rate } from "k6/metrics";
import { check, group, sleep } from 'k6';
import http from 'k6/http';

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

const RATE = (function(){
if(__ENV.VERSION == 'v701'){
switch(__ENV.HOST){
case 'c5xlarge': return 2400;
case 't3axlarge': return 1600;
case 't3anano': return 1500;
default: return 1000;
}
}
else switch(__ENV.HOST){
case 'c5xlarge': return 3000;
case 't3axlarge': return 2300;
case 't3anano': return 2200;
default: return 1000;
}
})();

export let options = {
discardResponseBodies: true,
scenarios: {
constant_request_rate: {
executor: 'constant-arrival-rate',
rate: RATE,
timeUnit: '1s',
duration: '30s',
preAllocatedVUs: 100,
maxVUs: 600,
}
},
thresholds: {
'failed requests': ['rate<0.1'],
'http_req_duration': ['p(95)<1000']
}
};

const myFailRate = new Rate('failed requests');

export default function() {
let res = http.get(URL + "/rpc/ret_artists?select=*&artist_id=eq.3");
myFailRate.add(res.status !== 200);
}
Loading

0 comments on commit 0754549

Please sign in to comment.