Skip to content

Commit 5474ebb

Browse files
authored
Merge pull request #747 from samurotko/Junction-Platform-2.0
added k6 stress tests for gavel
2 parents 131cfbc + c01e087 commit 5474ebb

9 files changed

Lines changed: 256 additions & 15 deletions

File tree

backend/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ const migrations = require('./migrations/index')
7575
/** A clone of the npm library throng, with a minor edit. See the file for details. */
7676
const throng = require('./misc/throng')
7777

78+
const memoryUsage = () => {
79+
const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024 * 100) / 100} MB`
80+
81+
const memoryData = process.memoryUsage()
82+
83+
const memoryUsage = {
84+
rss: `${formatMemoryUsage(memoryData.rss)} -> Resident Set Size - total memory allocated for the process execution`,
85+
heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -> total size of the allocated heap`,
86+
heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -> actual memory used during the execution`,
87+
external: `${formatMemoryUsage(memoryData.external)} -> V8 external memory`,
88+
}
89+
90+
console.log(memoryUsage)
91+
92+
}
93+
7894
throng({
7995
workers: process.env.WEB_CONCURRENCY || 1,
8096
grace: 1000,
@@ -99,6 +115,7 @@ throng({
99115

100116
})
101117

118+
memoryUsage()
102119

103120

104121

backend/modules/reviewing/gavel/Annotator.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ GavelAnnotatorSchema.methods.canVote = async function () {
122122
if (diffSeconds < Settings.ANNOTATOR_WAIT_SECONDS) {
123123
return Promise.reject(
124124
new ForbiddenError(
125-
`Must wait ${
126-
Settings.ANNOTATOR_WAIT_SECONDS - diffSeconds
125+
`Must wait ${Settings.ANNOTATOR_WAIT_SECONDS - diffSeconds
127126
} more seconds before voting again`,
128127
),
129128
)
@@ -172,7 +171,7 @@ GavelAnnotatorSchema.methods.getPreferredProjects = async function () {
172171
availableProjectsQuery,
173172
activeAnnotatorsQuery,
174173
])
175-
console.log("allProjects", allProjects, "activeAnnotators", activeAnnotators)
174+
//console.log("allProjects", allProjects, "activeAnnotators", activeAnnotators)
176175
// Helper function
177176
const asyncFilter = async (arr, predicate) => {
178177
const results = await Promise.all(arr.map(predicate))
@@ -189,11 +188,11 @@ GavelAnnotatorSchema.methods.getPreferredProjects = async function () {
189188
if (project) {
190189
const team = await Team.findById(project.team)
191190
if (team) {
192-
console.log(this.user, team.owner, !team.members)
193-
console.log(
194-
this.user !== team.owner &&
195-
!team.members.includes(this.user),
196-
)
191+
// console.log(this.user, team.owner, !team.members)
192+
// console.log(
193+
// this.user !== team.owner &&
194+
// !team.members.includes(this.user),
195+
// )
197196
return (
198197
this.user !== team.owner &&
199198
!team.members.includes(this.user)
@@ -271,11 +270,11 @@ GavelAnnotatorSchema.methods.getNextProject = async function () {
271270
}
272271

273272
GavelAnnotatorSchema.methods.assignNextProject = async function () {
274-
console.log('assigning')
275-
console.log(this.getNextProject, 'exists?')
276-
console.log(this, 'even this?')
273+
// console.log('assigning')
274+
// console.log(this.getNextProject, 'exists?')
275+
// console.log(this, 'even this?')
277276
const nextProject = await this.getNextProject()
278-
console.log('nextProject', nextProject)
277+
//console.log('nextProject', nextProject)
279278

280279
if (!this.next) {
281280
if (nextProject) {
@@ -293,7 +292,12 @@ GavelAnnotatorSchema.methods.assignNextProject = async function () {
293292
}
294293
}
295294

295+
//FOR GAVEL STRESS TEST:
296+
//comment this out
296297
return this.save()
298+
299+
//use this instead
300+
//return this //not saving for testing purposes
297301
}
298302

299303
GavelAnnotatorSchema.methods.skipCurrentProject = async function () {

backend/modules/reviewing/gavel/controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,13 @@ controller.initAnnotator = async (event, userId) => {
139139
team: team ? team._id : null,
140140
track: assignedTrack,
141141
})
142+
//FOR GAVEL START STRESS TEST:
143+
//comment these out
142144
const savedAnnator = await annotator.save()
143145
const next = savedAnnator.assignNextProject()
146+
147+
//use this instead
148+
//const next = annotator.assignNextProject() //not saving for testing purposes
144149
return next
145150
}
146151

@@ -210,9 +215,14 @@ controller.submitVote = async (event, userId, winningProjectId) => {
210215
loser: loser._id,
211216
})
212217

218+
//FOR GAVEL VOTE STRESS TEST:
219+
//comment this out
213220
await Promise.all([loser.save(), winner.save(), decision.save()])
214221
const updatedAnnotator = await annotator.assignNextProject()
215222

223+
224+
//use this instead
225+
//const updatedAnnotator = annotator
216226
return updatedAnnotator
217227
}
218228

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"dev": "nodemon index.js",
7+
"dev": "nodemon --inspect --max_old_space_size=2560 index.js",
88
"start": "node --max_old_space_size=2560 index.js",
99
"prod": "pm2 start --max_old_space_size=2560 index.js --watch",
1010
"pipe-logs": "pino-cloudwatch --aws_access_key_id=$AWS_ACCESS_KEY_ID --aws_secret_access_key=$AWS_SECRET_ACCESS_KEY --aws_region=$AWS_REGION --group=$AWS_CLOUDWATCH_LOG_GROUP",

frontend/src/pages/_dashboard/renderDashboard/participant/reviewing/CompareProjects.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ export default ({ annotator, prevId, nextId, isFirstChoice }) => {
3838
const fetchProjects = useCallback(async () => {
3939
setLoading(true)
4040
try {
41+
console.log("getting next")
4142
const [prev, next] = await Promise.all([
4243
GavelService.getProjectDetails(idToken, prevId),
4344
GavelService.getProjectDetails(idToken, nextId),
4445
])
46+
console.log(prev, next)
4547
setProjects({ prev, next })
4648
} catch (err) {
4749
dispatch(

frontend/src/redux/dashboard/actions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,8 @@ export const editProject = (slug, data) => async (dispatch, getState) => {
673673

674674
export const updateAnnotator = slug => async (dispatch, getState) => {
675675
const idToken = AuthSelectors.getIdToken(getState())
676-
676+
//get idToken for gavel start voting stress test
677+
//console.log(idToken)
677678
const { error } = await dispatch({
678679
type: ActionTypes.UPDATE_ANNOTATOR,
679680
promise: GavelService.getAnnotator(idToken, slug), //,
@@ -749,8 +750,11 @@ export const setFirstProjectSeen = slug => async (dispatch, getState) => {
749750
export const submitVote = (slug, winnerId) => async (dispatch, getState) => {
750751
const idToken = AuthSelectors.getIdToken(getState())
751752

753+
//get idToken and winnerId for gavel voting stress test
754+
console.log(idToken, slug, winnerId)
752755
try {
753756
const annotator = await GavelService.submitVote(idToken, slug, winnerId)
757+
console.log(annotator)
754758
dispatch({
755759
type: ActionTypes.EDIT_ANNOTATOR,
756760
payload: annotator,

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"only_build": "better-npm-run build",
1313
"build": "better-npm-run setup && better-npm-run build",
1414
"setup": "better-npm-run setup",
15+
"loadGavelVote": "cd tests && k6 run gavelSubmitVoteStressTest.js",
16+
"loadGavelStartVote": "cd tests && k6 run gavelStartVoteStressTest.js",
1517
"dev:frontend": "cd frontend && npm start",
1618
"dev:backend": "cd backend && npm run dev",
1719
"db-sync:prod-to-local": "sh ./scripts/sync-production-to-local.sh",
@@ -69,4 +71,4 @@
6971
"npm": "6.9.0"
7072
},
7173
"type": "module"
72-
}
74+
}

tests/gavelStartVoteStressTest.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import http from "k6/http"
2+
import { check, sleep } from "k6"
3+
import { Trend } from 'k6/metrics'
4+
//const memoryUsage = require('./backend/index')
5+
6+
export let SignUpDuration = new Trend('VoteStartDuration')
7+
8+
//TO EXECUTE START GAVEL TEST: COMMENT OUT SAVE FROM end of initAnnotator in backend\modules\reviewing\gavel\controller.js
9+
//and end of assignNextProject in backend\modules\reviewing\gavel\Annotator.js. This way the annotator is not saved and endpoint can be tested
10+
11+
12+
//ramp up to gradually to 500 users
13+
let duration = 10000
14+
export let options = {
15+
stages: [
16+
{
17+
vus: 1,
18+
duration: '10s',
19+
target: 10,
20+
thresholds: {
21+
'VoteStartDuration': [`p(95)<${duration}`]
22+
}
23+
},
24+
{
25+
vus: 10,
26+
target: 50,
27+
duration: '20s',
28+
thresholds: {
29+
'VoteStartDuration': [`p(95)<${duration}`]
30+
}
31+
},
32+
{
33+
vus: 50,
34+
target: 100,
35+
duration: '30s',
36+
thresholds: {
37+
'VoteStartDuration': [`p(95)<${duration}`]
38+
}
39+
},
40+
{
41+
vus: 100,
42+
target: 300,
43+
duration: '60s',
44+
thresholds: {
45+
'VoteStartDuration': [`p(95)<${duration}`]
46+
}
47+
},
48+
{
49+
vus: 300,
50+
target: 500,
51+
duration: '60s',
52+
thresholds: {
53+
'VoteStartDuration': [`p(95)<${duration}`]
54+
}
55+
},
56+
57+
],
58+
}
59+
60+
61+
export default function () {
62+
63+
64+
65+
66+
// idToken from e.g. frontend\src\redux\dashboard\actions.js updateAnnotator console.log
67+
const idToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InFET2pZVVFpLVhzVUJHbkk0QkZTZiJ9.eyJodHRwczovL2FwcC5oYWNranVuY3Rpb24uY29tL2NvdW50cnkiOiJGaW5sYW5kIiwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9jaXR5IjoiVHVya3UiLCJodHRwczovL2FwcC5oYWNranVuY3Rpb24uY29tL2xhdGl0dWRlIjo2MC40NTU5LCJodHRwczovL2FwcC5oYWNranVuY3Rpb24uY29tL2xvbmdpdHVkZSI6MjIuMjc3MSwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9yb2xlcyI6WyJBc3Npc3RhbnRPcmdhbmlzZXIiLCJSZWNydWl0ZXIiXSwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9wZXJtaXNzaW9ucyI6WyJhY2Nlc3M6cmVjcnVpdG1lbnQiLCJtYW5hZ2U6ZXZlbnQiXSwiaHR0cHM6Ly9hcHAu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.post("http://localhost:2222/api/reviewing/gavel/junction-2023/annotator", {}, {
71+
headers: {
72+
Authorization: `Bearer ${idToken}`,
73+
}
74+
})
75+
76+
check(res, {
77+
"status is 200": (r) => r.status === 200,
78+
79+
'transaction time is less than threshold': res => res.timings.duration < duration
80+
})
81+
82+
sleep(1)
83+
}

tests/gavelSubmitVoteStressTest.js

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import http from "k6/http"
2+
import { check, sleep } from "k6"
3+
import { Trend } from 'k6/metrics'
4+
//const memoryUsage = require('./backend/index')
5+
6+
export let SignUpDuration = new Trend('VoteStartDuration')
7+
8+
//TO EXECUTE START GAVEL TEST: COMMENT OUT SAVE FROM end of initAnnotator in backend\modules\reviewing\gavel\controller.js
9+
//and end of assignNextProject in backend\modules\reviewing\gavel\Annotator.js. This way the annotator is not saved and endpoint can be tested
10+
11+
12+
//ramp up to gradually to 500 users
13+
let duration = 10000
14+
export let options = {
15+
scenarios: {
16+
constant_request_rate: {
17+
executor: 'constant-arrival-rate',
18+
rate: 1500,
19+
timeUnit: '1s', // 1000 iterations per second, i.e. 1000 RPS
20+
duration: '30s',
21+
preAllocatedVUs: 200, // how large the initial pool of VUs would be
22+
maxVUs: 500, // if the preAllocatedVUs are not enough, we can initialize more
23+
},
24+
}
25+
// stages: [
26+
// {
27+
// vus: 1,
28+
// duration: '10s',
29+
// target: 10,
30+
// thresholds: {
31+
// 'VoteStartDuration': [`p(95)<${duration}`]
32+
// }
33+
// },
34+
// {
35+
// vus: 10,
36+
// target: 50,
37+
// duration: '20s',
38+
// thresholds: {
39+
// 'VoteStartDuration': [`p(95)<${duration}`]
40+
// }
41+
// },
42+
// {
43+
// vus: 50,
44+
// target: 100,
45+
// duration: '30s',
46+
// thresholds: {
47+
// 'VoteStartDuration': [`p(95)<${duration}`]
48+
// }
49+
// },
50+
// {
51+
// vus: 100,
52+
// target: 300,
53+
// duration: '60s',
54+
// thresholds: {
55+
// 'VoteStartDuration': [`p(95)<${duration}`]
56+
// }
57+
// },
58+
// {
59+
// vus: 300,
60+
// target: 500,
61+
// duration: '60s',
62+
// thresholds: {
63+
// 'VoteStartDuration': [`p(95)<${duration}`]
64+
// }
65+
// },
66+
67+
68+
69+
//],
70+
}
71+
72+
73+
export default async function () {
74+
75+
76+
77+
78+
// idToken from e.g. frontend\src\redux\dashboard\actions.js updateAnnotator console.log
79+
const idToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InFET2pZVVFpLVhzVUJHbkk0QkZTZiJ9.eyJodHRwczovL2FwcC5oYWNranVuY3Rpb24uY29tL2NvdW50cnkiOiJGaW5sYW5kIiwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9jaXR5IjoiVHVya3UiLCJodHRwczovL2FwcC5oYWNranVuY3Rpb24uY29tL2xhdGl0dWRlIjo2MC40NTU5LCJodHRwczovL2FwcC5oYWNranVuY3Rpb24uY29tL2xvbmdpdHVkZSI6MjIuMjc3MSwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9yb2xlcyI6WyJBc3Npc3RhbnRPcmdhbmlzZXIiLCJSZWNydWl0ZXIiXSwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9wZXJtaXNzaW9ucyI6WyJhY2Nlc3M6cmVjcnVpdG1lbnQiLCJtYW5hZ2U6ZXZlbnQiXSwiaHR0cHM6Ly9hcHAuaGFja2p1bmN0aW9uLmNvbS9lbWFpbCI6InNhbXUucm90a29AaGFja2p1bmN0aW9uLmNvbSIsImh0dHBzOi8vYXBwLmhhY2tqdW5jdGlvbi5jb20vZW1haWxfdmVyaWZpZWQiOnRydWUsImh0dHBzOi8vYXBwLmhhY2tqdW5jdGlvbi5jb20vcmVjcnVpdGVyX2V2ZW50cyI6W3sib3JnYW5pc2F0aW9uIjoianVuY3Rpb24xIiwiX2lkIjoiNjUyNTNkNzY0NzBkZTIzNGQwNzNkZWI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LCJpc3MiOiJodHRwczovL2Rldi1oYWNranVuY3Rpb24uZXUuYXV0aDAuY29tLyIsImF1ZCI6IllvUkU2Z1c5aXRCekxVQVY3SzNDV1FiMHVzVUFsUWNHIiwiaWF0IjoxNzAyNTU5ODczLCJleHAiOjE3MDI1OTU4NzMsInN1YiI6Imdvb2dsZS1vYXV0aDJ8MTA4ODk4NzgzOTkxNTI2MzYwNzE2IiwiYXRfaGFzaCI6Imc5a1JDUkVhc1dZMm54aXJ0V3Bzd3ciLCJzaWQiOiJzYy04S0VJUnNKUFktckV1M1N1dTRiczMyVnAzZjVqQyIsIm5vbmNlIjoid35Qa0E4UkhQUVMtcnB1Y1oweVR4bTVwczhOWTlFLlIifQ.A6Ses4RfRrKKzD5P9hya719c8JWAllv-VpqC2S91lUbKKcx5eNO39lpKSnvG60-gtBcmNZ2F5Cd8D77q5A0U_8cKEDlrkYcneR50otDfE4negVNs0vc8U-mVhljqTwg2ln9iBxDOq6Nme3YFmT1C4ojoxs_zNpEhGpPZtPanrWdlNv6N5WTuIukU2HCdasyb2ouDQcapUpIN_z5PZH5dfGBO7vArU4SmH6m_zhSntcewBwWMJ5HXnioIjjfhuB2alQy3m56Y-IKxuv3yEZd3u8OMzL13RZ8HDxElgqJvMAMH0erGKdSAT1KhT8Itj9jnVwqeQKG4_bsy7M2dnrXq7g"
80+
const project1 = "6550859db8d7d037d378be7e"
81+
const project2 = "654fed54c79f444a8114f921"
82+
//let res = _axios.post(`${BASE_ROUTE}/${slug}/annotator`, {}, config(idToken))
83+
let res = await http.post("http://localhost:2222/api/reviewing/gavel/junction-2023/vote/6550859db8d7d037d378be7e", {}, {
84+
headers: {
85+
Authorization: `Bearer ${idToken}`,
86+
}
87+
})
88+
89+
let project1Res = await http.get("http://localhost:2222/api/reviewing/gavel/projects/6550859db8d7d037d378be7e", {
90+
headers: {
91+
Authorization: `Bearer ${idToken}`,
92+
}
93+
})
94+
let project2Res = await http.get("http://localhost:2222/api/reviewing/gavel/projects/654fed54c79f444a8114f921", {
95+
headers: {
96+
Authorization: `Bearer ${idToken}`,
97+
}
98+
})
99+
100+
check(res, {
101+
"vote status is 200": (r) => r.status === 200,
102+
103+
'transaction time is less than threshold': res => res.timings.duration < duration
104+
})
105+
106+
check(project1Res, {
107+
"get project 1 status is 200": (project1Res) => project1Res.status === 200,
108+
109+
'transaction time is less than threshold': project1Res => project1Res.timings.duration < duration
110+
})
111+
112+
check(project2Res, {
113+
"get project 2 status is 200": (project2Res) => project2Res.status === 200,
114+
115+
'transaction time is less than threshold': project2Res => project2Res.timings.duration < duration
116+
})
117+
118+
sleep(1)
119+
}

0 commit comments

Comments
 (0)