mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 14:37:34 +00:00
perf(query): reduce user query duration (#10037)
# Which Problems Are Solved The resource usage to query user(s) on the database was high and therefore could have performance impact. # How the Problems Are Solved Database queries involving the users and loginnames table were improved and an index was added for user by email query. # Additional Changes - spellchecks - updated apis on load tests # additional info needs cherry pick to v3
This commit is contained in:
@@ -13,7 +13,7 @@ export function createOrg(accessToken: string): Promise<Org> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let response = http.asyncRequest(
|
||||
'POST',
|
||||
url('/v2beta/organizations'),
|
||||
url('/v2/organizations'),
|
||||
JSON.stringify({
|
||||
name: `load-test-${new Date(Date.now()).toISOString()}`,
|
||||
}),
|
||||
|
@@ -15,7 +15,7 @@ export async function setup() {
|
||||
}
|
||||
|
||||
export default async function (data: any) {
|
||||
const human = await createHuman(`vu-${__VU}`, data.org, data.tokens.accessToken);
|
||||
const human = await createHuman(`vu-${__VU}-${new Date(Date.now()).getTime()}`, data.org, data.tokens.accessToken);
|
||||
const updateRes = await updateHuman(
|
||||
{
|
||||
profile: {
|
||||
|
@@ -30,7 +30,7 @@ export function createHuman(username: string, org: Org, accessToken: string): Pr
|
||||
familyName: 'Zitizen',
|
||||
},
|
||||
email: {
|
||||
email: `zitizen-@caos.ch`,
|
||||
email: `${username}@zitadel.com`,
|
||||
isVerified: true,
|
||||
},
|
||||
password: {
|
||||
@@ -50,11 +50,11 @@ export function createHuman(username: string, org: Org, accessToken: string): Pr
|
||||
response
|
||||
.then((res) => {
|
||||
check(res, {
|
||||
'create user is status ok': (r) => r.status === 201,
|
||||
'create user is status ok': (r) => r.status === 200,
|
||||
}) || reject(`unable to create user(username: ${username}) status: ${res.status} body: ${res.body}`);
|
||||
createHumanTrend.add(res.timings.duration);
|
||||
|
||||
const user = http.get(url(`/v2beta/users/${res.json('userId')!}`), {
|
||||
const user = http.get(url(`/v2/users/${res.json('userId')!}`), {
|
||||
headers: {
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
|
Reference in New Issue
Block a user