mirror of
https://github.com/LukeHagar/appwrite-starter-function.git
synced 2025-12-06 04:19:14 +00:00
Swap from get and set to raw set
This commit is contained in:
32
bun-load-test.yaml
Normal file
32
bun-load-test.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
config:
|
||||
target: http://bun.plygrnd.org
|
||||
phases:
|
||||
- duration: 60
|
||||
arrivalRate: 1
|
||||
rampTo: 10
|
||||
name: Warm up phase
|
||||
- duration: 60
|
||||
arrivalRate: 10
|
||||
rampTo: 30
|
||||
name: Ramp up load
|
||||
- duration: 30
|
||||
arrivalRate: 10
|
||||
rampTo: 30
|
||||
name: Spike phase
|
||||
# Load & configure a couple of useful plugins
|
||||
# https://docs.art/reference/extensions
|
||||
plugins:
|
||||
ensure: {}
|
||||
apdex: {}
|
||||
metrics-by-endpoint: {}
|
||||
apdex:
|
||||
threshold: 100
|
||||
ensure:
|
||||
thresholds:
|
||||
- http.response_time.p99: 100
|
||||
- http.response_time.p95: 75
|
||||
scenarios:
|
||||
- flow:
|
||||
- get:
|
||||
url: "/"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Client , Databases } from 'node-appwrite';
|
||||
import { Client , Databases, ID } from 'node-appwrite';
|
||||
|
||||
// This is your Appwrite function
|
||||
// It's executed each time we get a request
|
||||
@@ -24,14 +24,10 @@ export default async ({ req, res, log, error }: any) => {
|
||||
|
||||
// The `req` object contains the request data
|
||||
if (req.method === "GET") {
|
||||
const doc = await databases.getDocument(
|
||||
"metrics",
|
||||
"load",
|
||||
"65ca2f77931f5ebb7d19"
|
||||
);
|
||||
log(doc["count"]);
|
||||
await databases.updateDocument("metrics", "load", "65ca2f77931f5ebb7d19", {count: doc["count"] + 1})
|
||||
return res.send(`Count Updated`);
|
||||
await databases.createDocument("load", "bun", ID.unique(), {
|
||||
count: 1,
|
||||
});
|
||||
return res.send(`Created Record`);
|
||||
} else {
|
||||
return res.send(`Invalid request method. Please use GET.`);
|
||||
}
|
||||
|
||||
@@ -24,16 +24,10 @@ export default async ({ req, res, log, error }) => {
|
||||
|
||||
// The `req` object contains the request data
|
||||
if (req.method === "GET") {
|
||||
const doc = await databases.getDocument(
|
||||
"metrics",
|
||||
"load",
|
||||
"65ca2e4954a2e5c286d0"
|
||||
);
|
||||
log(doc["count"]);
|
||||
await databases.updateDocument("metrics", "load", "65ca2e4954a2e5c286d0", {
|
||||
count: doc["count"] + 1,
|
||||
await databases.createDocument("load", "node", ID.unique(), {
|
||||
count: 1,
|
||||
});
|
||||
return res.send(`Count Updated`);
|
||||
return res.send(`Created Record`);
|
||||
} else {
|
||||
return res.send(`Invalid request method. Please use GET.`);
|
||||
}
|
||||
|
||||
32
node-load-test.yaml
Normal file
32
node-load-test.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
config:
|
||||
target: http://node.plygrnd.org
|
||||
phases:
|
||||
- duration: 60
|
||||
arrivalRate: 1
|
||||
rampTo: 10
|
||||
name: Warm up phase
|
||||
- duration: 60
|
||||
arrivalRate: 10
|
||||
rampTo: 30
|
||||
name: Ramp up load
|
||||
- duration: 30
|
||||
arrivalRate: 10
|
||||
rampTo: 30
|
||||
name: Spike phase
|
||||
# Load & configure a couple of useful plugins
|
||||
# https://docs.art/reference/extensions
|
||||
plugins:
|
||||
ensure: {}
|
||||
apdex: {}
|
||||
metrics-by-endpoint: {}
|
||||
apdex:
|
||||
threshold: 100
|
||||
ensure:
|
||||
thresholds:
|
||||
- http.response_time.p99: 100
|
||||
- http.response_time.p95: 75
|
||||
scenarios:
|
||||
- flow:
|
||||
- get:
|
||||
url: "/"
|
||||
|
||||
Reference in New Issue
Block a user