-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Benchmark Example | ||
|
||
## Usage | ||
|
||
First, ensure you have `k6` installed. Then, start the server: | ||
|
||
```bash | ||
$ falcon serve --bind http://localhost:9292 | ||
``` | ||
|
||
Then run `k6`: | ||
|
||
```bash | ||
$ k6 run small.js | ||
``` | ||
## Comparison | ||
|
||
You could start the included `config.ru` with other servers and compare. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export const options = { | ||
stages: [ | ||
// Warmup: Gradually ramp up: | ||
{duration: '10s', target: 64}, | ||
|
||
// Main test: Sustained load: | ||
{duration: '1m', target: 64}, | ||
], | ||
}; | ||
|
||
import http from 'k6/http'; | ||
import { check, sleep } from 'k6'; | ||
|
||
export default function () { | ||
const res = http.get('http://localhost:9292/small'); | ||
|
||
check(res, { | ||
'is status 200': (r) => r.status === 200, | ||
'response time < 200ms': (r) => r.timings.duration < 200, | ||
}); | ||
} |