Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Benchmark Rest Apis #202

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/benchmark-cp-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Benchmark Control Plane Build and Test

on:
pull_request:
paths:
- benchmark-control-plane/**

jobs:
build-and-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: benchmark-control-plane/infra

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v4
with:
node-version: 16.x

- name: Run CDK Build and Test
run: |
npm install
npm run build

- name: Run test coverage
run: |
npm test -- --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*.js
!.eslintrc.js
!jest.config.js
*.d.ts
node_modules
cdk.context.json
.DS_Store
lib/.DS_Store

# CDK asset staging directory
.cdk.staging
cdk.out

# Coverage directory used by tools like istanbul
coverage

# coverage output
coverage.lcov

# excluding intellij Idea files
*.iml
.idea/
.vscode/
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"

[dev-packages]

[requires]
python_version = "3.10"
python_full_version = "3.10.13"
151 changes: 151 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions benchmark-control-plane/infra/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
env: {
browser: false,
es6: true,
jest: true,
},
extends: [
'airbnb-base',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
},
plugins: [
'@typescript-eslint',
],
rules: {
hasTrailingComma: 'off',
indent: ['error', 2],
'import/extensions': 'error',
'import/no-namespace': 'error',
'import/no-unresolved': 'error',
'import/no-extraneous-dependencies': 'error',
'import/prefer-default-export': 'off',
'max-classes-per-file': 'off',
'no-unused-vars': 'off',
'no-new': 'off',
'max-len': ['error', { 'code': 160, 'ignoreComments': true }],
"no-param-reassign": 0,
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"]
},
};
11 changes: 11 additions & 0 deletions benchmark-control-plane/infra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.js
!.eslintrc.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
.DS_Store
../.DS_Store
6 changes: 6 additions & 0 deletions benchmark-control-plane/infra/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
14 changes: 14 additions & 0 deletions benchmark-control-plane/infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `npx cdk deploy` deploy this stack to your default AWS account/region
* `npx cdk diff` compare deployed stack with current state
* `npx cdk synth` emits the synthesized CloudFormation template
26 changes: 26 additions & 0 deletions benchmark-control-plane/infra/bin/infra.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { App } from 'aws-cdk-lib';
import { BenchmarkRestApiStack } from '../lib/restApi';
import { Monitoring } from '../lib/monitoring';

const app = new App();

const region = app.node.tryGetContext('region') ?? process.env.CDK_DEFAULT_REGION;
const account = app.node.tryGetContext('account') ?? process.env.CDK_DEFAULT_ACCOUNT;

const infraStack = new BenchmarkRestApiStack(app, 'benchmark-control-plane-stack', {
env: {
region,
account,
},
});

const monitoringStack = new Monitoring(app, 'benchmark-cp-monitor-stack', {
env: {
region: 'us-east-1',
account: process.env.CDK_DEFAULT_ACCOUNT,
},
restApi: infraStack.getRestApi(),
lambdaFunctions: infraStack.lambdaObject.getLambdaFunctions(),
});

monitoringStack.addDependency(infraStack);
66 changes: 66 additions & 0 deletions benchmark-control-plane/infra/cdk.context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"vpc-provider:account=592316141094:filter.vpc-id=vpc-02a906fc9397a5315:region=us-east-1:returnAsymmetricSubnets=true": {
"vpcId": "vpc-02a906fc9397a5315",
"vpcCidrBlock": "10.0.0.0/16",
"ownerAccountId": "592316141094",
"availabilityZones": [],
"subnetGroups": [
{
"name": "Private",
"type": "Private",
"subnets": [
{
"subnetId": "subnet-0b9cde4832325a6b2",
"cidr": "10.0.128.0/20",
"availabilityZone": "us-east-1a",
"routeTableId": "rtb-0e8b7a98d83de2fdb"
},
{
"subnetId": "subnet-0dc597bbb6b49e29b",
"cidr": "10.0.144.0/20",
"availabilityZone": "us-east-1b",
"routeTableId": "rtb-0b0f742ef8ec97e29"
},
{
"subnetId": "subnet-0a87255dd71c4ad54",
"cidr": "10.0.160.0/20",
"availabilityZone": "us-east-1c",
"routeTableId": "rtb-08909766c711e4639"
}
]
},
{
"name": "Public",
"type": "Public",
"subnets": [
{
"subnetId": "subnet-0ec6c9182017831bc",
"cidr": "10.0.0.0/20",
"availabilityZone": "us-east-1a",
"routeTableId": "rtb-089a05b2e5296f778"
},
{
"subnetId": "subnet-0b884682c462c3586",
"cidr": "10.0.16.0/20",
"availabilityZone": "us-east-1b",
"routeTableId": "rtb-089a05b2e5296f778"
},
{
"subnetId": "subnet-06fca5eca7269f509",
"cidr": "10.0.32.0/20",
"availabilityZone": "us-east-1c",
"routeTableId": "rtb-089a05b2e5296f778"
}
]
}
]
},
"availability-zones:account=592316141094:region=us-east-1": [
"us-east-1a",
"us-east-1b",
"us-east-1c",
"us-east-1d",
"us-east-1e",
"us-east-1f"
]
}
Loading
Loading