Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Chore(Doc): Update Readme With Load Testing Report
Browse files Browse the repository at this point in the history
  • Loading branch information
toksdotdev committed Dec 31, 2020
1 parent 7f7b9b8 commit 42d04a4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 165 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A dead-simple service that screenshots webpages, and sends the links to your ema
## Design Goals

- **Security:** All webpages are opened both in _sandboxed chromium_ and _icognito mode_.
- **Scalability:** Easily handles ~2086 reqs/s on a single node. For load performance, see [load-testing](#load-testing).
- **Scalability:** Handles ~2.3k reqs/s on a single node. For load performance, see [load-testing](#load-testing).
- **Resilience:** Chromium instance automatically restarts on sudden crash without interrupting the job queue. Jobs that get affected are auto-retried.
- **Reduced memory footprints:** Puppeteer is used under the hood to capture screeshots. To reduce memory footprint, **only one** Chromium instance exists throughout the service lifetime irrespective of the number of screenshot workers that are running.
- **Portability:** Docker build (with `docker-compose`) supported and can easily be scaled in any containerized environment.
Expand Down Expand Up @@ -51,9 +51,10 @@ This should serve application on the following URL: `https://localhost:3000`
#### Development

To run a development server:

- Run `npm i` (if you have chrome installed, run `npm i --no-optional`).
- Update your environment variables.
- Run `npm run start:concurrenct` (watches and restarts the server with nodemon)
- Run `npm run start:concurrenct` (watches and restarts the server with nodemon)

> Don't forget to update your `REDIS_URL` to your local instance.
Expand Down Expand Up @@ -125,7 +126,7 @@ The default load test uses the folllowing parameters:
To configure load testing paramaters, see [supported CLI parameters for k6](https://k6.io/docs/getting-started/running-k6), and run as follows:

```bash
k6 run --vu 1000 <add more parameters here> ./test/load-testing/index.ts
k6 run --vus 1000 <add more parameters here> ./test/load-testing/index.ts
```

### Specification
Expand All @@ -136,6 +137,10 @@ Here are the machine specs for the sample load testing shown below:
- 2.8 GHz Intel Core i7
- 16 GB 2133 MHz LPDDR3

## Report

![Quickshot Load Testing Report](https://res.cloudinary.com/dsc/image/upload/v1609408572/quickshot-load-testing.png)

## Contributing

If you see any way to improve this service, please kindly open a PR.
159 changes: 0 additions & 159 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"ioredis-mock": "^5.2.0",
"jest": "^26.6.3",
"kill-port": "^1.6.1",
"loadtest": "^5.1.2",
"nodemon": "^1.19.2",
"supertest": "^4.0.2",
"ts-jest": "^26.4.4",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const isProduction = () => process.env.NODE_ENV === "production";
export default createLogger({
format: isProduction() ? format.json() : format.cli(),
transports: [
new transports.Console({ level: isProduction() ? "error" : "debug" }),
new transports.Console({ level: isProduction() ? "info" : "debug" }),
new transports.File({ filename: "debug.log", level: "debug" }),
],
});
3 changes: 2 additions & 1 deletion test/load-testing/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import http from "k6/http";
import { check } from "k6";

const domains = open("./data/domains.txt").toString().split("\n");

Expand All @@ -15,5 +16,5 @@ export default function () {
};

const res = http.post("http://localhost:3000/screenshot", payload, params);
console.log(JSON.stringify(res.body));
check(res, { "Status was 200": (r) => r.status == 200 });
}

0 comments on commit 42d04a4

Please sign in to comment.