-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
b130a95
commit a4a1548
Showing
3 changed files
with
41 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
ovh.conf | ||
.env | ||
test.js | ||
monitoring.sh | ||
notes.md |
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
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,37 @@ | ||
import http from "k6/http"; | ||
import { check } from "k6"; | ||
|
||
export const options = { vus: 4, iterations: 40 }; | ||
|
||
const url = `https://${__ENV.HOST_IP}.nip.io/api/generate`; | ||
|
||
const prompts = [ | ||
"Explain how a car engine works", | ||
"Write a short story about a magical forest", | ||
"What are the main principles of machine learning?", | ||
"Describe the process of photosynthesis", | ||
"Write a recipe for chocolate cake", | ||
"Explain the theory of relativity", | ||
"What are the benefits of meditation?", | ||
"How does the internet work?", | ||
]; | ||
|
||
const params = { | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Basic ${__ENV.HOST_CREDENTIALS}` | ||
}, | ||
timeout: '300s', | ||
}; | ||
|
||
export default function () { | ||
const randomIndex = Math.floor(Math.random() * prompts.length); | ||
const prompt = prompts[randomIndex]; | ||
|
||
const payload = JSON.stringify({ prompt, model: "llama3.1" }); | ||
const response = http.post(url, payload, params); | ||
|
||
check(response, { | ||
"status is 200": (r) => r.status === 200, | ||
}); | ||
} |