https://github.com/alexgalhardo/learning-load-stress-tests
A side project I created to learn and improve my skills in k6, concurrency, parallelism, A.C.I.D & Transactions CRUD operations, load balancer and performance benchmarkings using different technologies and databases :bomb:
https://github.com/alexgalhardo/learning-load-stress-tests
api aws bun docker graphql json-rpc2 k6 load-balancer load-testing mongodb nginx nodejs postgresql redis redis-database serverless stress-testing typescript
Last synced: 2 months ago
JSON representation
A side project I created to learn and improve my skills in k6, concurrency, parallelism, A.C.I.D & Transactions CRUD operations, load balancer and performance benchmarkings using different technologies and databases :bomb:
- Host: GitHub
- URL: https://github.com/alexgalhardo/learning-load-stress-tests
- Owner: AlexGalhardo
- License: mit
- Created: 2024-03-30T22:43:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-19T13:46:31.000Z (almost 2 years ago)
- Last Synced: 2025-02-24T06:51:56.225Z (over 1 year ago)
- Topics: api, aws, bun, docker, graphql, json-rpc2, k6, load-balancer, load-testing, mongodb, nginx, nodejs, postgresql, redis, redis-database, serverless, stress-testing, typescript
- Language: HTML
- Homepage:
- Size: 54.4 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
:bomb: Learning Load & Stress Tests :bomb:
## Introduction
- A side project I created to learn and improve my skills in:
- [k6](https://k6.io/)
- Load Tests & Stress Tests
- Load Balancer
- Concurrency & Parallelism
- A.C.I.D and Transactions CRUD operations
- Performance Benchmarks using diferent technologies and databases
- Technologies:
- [NodeJS](https://nodejs.org/en)
- [Bun](https://bun.sh/)
- [ElysiaJS](https://elysiajs.com/)
- [Fastify](https://fastify.dev/)
- [PM2 Process Manager](https://pm2.keymetrics.io/)
- [VineJS Data Validator](https://vinejs.dev/docs/introduction)
- [TypeScript](https://www.typescriptlang.org/)
- [MongoDB](https://www.mongodb.com/)
- [Mongoose ODM](https://mongoosejs.com/)
- [PostgreSQL](https://www.postgresql.org/)
- [Prisma ORM](https://www.prisma.io/)
- [Redis](https://redis.io/)
- [Docker](https://www.docker.com/)
- [JSON-RPC](https://www.jsonrpc.org/)
- [NGINX](https://www.nginx.com/)
- [GraphQL](https://graphql.org/)
- [Serverless Framework](https://www.serverless.com/)
- [AWS](https://aws.amazon.com/)
- [Lambda](https://aws.amazon.com/lambda/)
- [DynamoDB](https://aws.amazon.com/dynamodb/)
- [API Gateway](https://aws.amazon.com/api-gateway/)
## ToDo
- [x] API using MongoDB
- [x] API using PostgreSQL
- [x] API using Serverless Framework and DynamoDB
- [x] API using Load Balancer
- [x] API using RPC
- [x] API using GraphQL
- [x] API using REST
- [x] API using Redis
## Videos Demo
### Testing REST Postgres API
https://github.com/AlexGalhardo/learning-load-stress-tests/assets/19540357/b1e1bf42-a661-4983-abee-994f9f2689d6
### Testing GraphQL Redis API
https://github.com/AlexGalhardo/learning-load-stress-tests/assets/19540357/f0382aad-c85d-4137-a958-449ead1cf491
## Prerequisites
- Install k6: https://k6.io/docs/get-started/installation/
- Install Bun: https://bun.sh/docs/installation
- Install NodeJS >= v20: https://nodejs.org/en/download/package-manager
- Install Docker & Docker Compose: https://docs.docker.com/engine/install/
- Have an AWS Account: https://aws.amazon.com/free/
## Up API Servers
- Enter the API folder you wanna test and follow README.md instructions
## Tips
- K6 Reports:
- To see k6 tests reports, up a server in the root of this project
- And go for example: http://localhost:3000/k6-tests/reports/rest-postgres-api-load-test-signup.html
- POST /signup:
- Tests are made using fake data, to not repeat the same signup
- POST /checkout:
- Check to increase ou add more stock units as you want in database while you are testing.
## :warning: Doing :warning:
- [x] Finish REST Postgres API Tests
- [x] Finish GraphQL Redis API Tests
- [x] Finish JSON-RPC MongoDB API Tests
- [ ] Finish Serverless API Tests
- [ ] Finish NGINX Load Balancer API Tests
## Load Tests
- ### POST /signup
- Enter folder [./k6-tests](./k6-tests/)
- Testing GraphQL Redis API:
```bash
k6 run graphql-redis-api-load-test-signup.js
```
- See report: [./k6-tests/reports/graphql-redis-api-load-test-signup.html](./k6-tests/reports/graphqL-redis-api-load-test-signup.html)
- Testing REST Postgres API:
```bash
k6 run rest-postgres-api-load-test-signup.js
```
- See report: [./k6-tests/reports/rest-postgres-api-load-test-signup.html](./k6-tests/reports/rest-postgres-api-load-test-signup.html)
- Testing JSON-RPC MongoDB API:
```bash
k6 run json-rpc-mongodb-api-load-test-signup.js
```
- See report: [./k6-tests/reports/json-rpc-mongodb-api-load-test-signup.html](./k6-tests/reports/json-rpc-mongodb-api-load-test-signup.html)
- ### POST /checkout (Last Stock Units - simulating a black friday):
- Enter folder [./k6-tests](./k6-tests/)
- Testing GraphQL Redis API:
```bash
k6 run graphql-redis-api-load-test-checkout.js
```
- See report: [./k6-tests/reports/graphql-redis-api-load-test-checkout.html](./k6-tests/reports/graphql-redis-api-load-test-checkout.html)
- Testing REST Postgres API:
```bash
k6 run rest-postgres-api-load-test-checkout.js
```
- See report: [./k6-tests/reports/rest-postgres-api-load-test-checkout.html](./k6-tests/reports/rest-postgres-api-load-test-checkout.html)
- Testing JSON-RPC MongoDB API:
```bash
k6 run json-rpc-mongodb-api-load-test-checkout.js
```
- See report: [./k6-tests/reports/json-rpc-mongodb-api-load-test-checkout.html](./k6-tests/reports/json-rpc-mongodb-api-load-test-checkout.html)
## Stress Tests
- ### POST /signup
- Enter folder [./k6-tests](./k6-tests/)
- Testing GraphQL Redis API:
```bash
k6 run graphql-redis-api-stress-test-signup.js
```
- See report: [./k6-tests/reports/graphql-redis-api-stress-test-signup.html](./k6-tests/reports/graphql-redis-api-stress-test-signup.html)
- Testing REST Postgres API:
```bash
k6 run rest-postgres-api-stress-test-signup.js
```
- See report: [./k6-tests/reports/rest-postgres-api-stress-test-signup.html](./k6-tests/reports/rest-postgres-api-stress-test-signup.html)
- Testing JSON-RPC MongoDB API:
```bash
k6 run json-rpc-mongodb-api-stress-test-signup.js
```
- See report: [./k6-tests/reports/json-rpc-mongodb-api-stress-test-signup.html](./k6-tests/reports/json-rpc-mongodb-api-stress-test-signup.html)
- ### POST /checkout (Last Stock Units - simulating a black friday):
- Enter folder [./k6-tests](./k6-tests/)
- Testing GraphQL Redis API:
```bash
k6 run graphql-redis-api-stress-test-checkout.js
```
- See report: [./k6-tests/reports/graphql-redis-api-stress-test-checkout.html](./k6-tests/reports/graphql-redis-api-stress-test-checkout.html)
- Testing REST Postgres API:
```bash
k6 run rest-postgres-api-stress-test-checkout.js
```
- See report: [./k6-tests/reports/rest-postgres-api-stress-test-checkout.html](./k6-tests/reports/rest-postgres-api-stress-test-checkout.html)
- Testing JSON-RPC MongoDB API:
```bash
k6 run json-rpc-mongodb-api-stress-test-checkout.js
```
- See report: [./k6-tests/reports/json-rpc-mongodb-api-stress-test-checkout.html](./k6-tests/reports/json-rpc-mongodb-api-stress-test-checkout.html)
## K6 Reports Examples
### [./k6-tests/reports/rest-postgres-api-stress-test-signup.html](./k6-tests/reports/rest-postgres-api-stress-test-signup.html)

### [./k6-tests/reports/rest-postgres-api-stress-test-checkout.html](./k6-tests/reports/rest-postgres-api-stress-test-checkout.html)

### [./k6-tests/reports/graphql-redis-api-stress-test-checkout.html](./k6-tests/reports/graphql-redis-api-stress-test-checkout.html)


### [./k6-tests/reports/json-rpc-mongodb-api-stress-test-checkout.html](./k6-tests/reports/json-rpc-mongodb-api-stress-test-checkout.html)



## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) March 2024-present, [Alex Galhardo](https://github.com/AlexGalhardo)