zitadel/internal/repository
Tim Möhlmann 63d733b3a2
perf(oidc): disable push of user token meta-event (#8691)
# Which Problems Are Solved

When executing many concurrent authentication requests on a single
machine user, there were performance issues. As the same aggregate is
being searched and written to concurrently, we traced it down to a
locking issue on the used index.
We already optimized the token endpoint by creating a separate OIDC
aggregate.

At the time we decided to push a single event to the user aggregate, for
the user audit log. See [technical advisory
10010](https://zitadel.com/docs/support/advisory/a10010) for more
details.

However, a recent security fix introduced an additional search query on
the user aggregate, causing the locking issue we found.

# How the Problems Are Solved

Add a feature flag which disables pushing of the `user.token.v2.added`.
The event has no importance and was only added for informational
purposes on the user objects. The `oidc_session.access_token.added` is
the actual payload event and is pushed on the OIDC session aggregate and
can still be used for audit trail.

# Additional Changes

- Fix an event mapper type for
`SystemOIDCSingleV1SessionTerminationEventType`

# Additional Context

- Reported by support request
- https://github.com/zitadel/zitadel/pull/7822 changed the token
aggregate
- https://github.com/zitadel/zitadel/pull/8631 introduced user state
check

Load test trace graph with `user.token.v2.added` **enabled**. Query
times are steadily increasing:


![image](https://github.com/user-attachments/assets/4aa25055-8721-4e93-b695-625560979909)

Load test trace graph with `user.token.v2.added` **disabled**. Query
times constant:


![image](https://github.com/user-attachments/assets/a7657f6c-0c55-401b-8291-453da5d5caf9)

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2024-09-26 13:55:41 +00:00
..
action fix(setup): init projections (#7194) 2024-01-25 17:28:20 +01:00
asset refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
authrequest fix(oidc): store requested response_mode (#8145) 2024-06-17 09:50:12 +00:00
debug_events feat: add debug events API (#8533) 2024-09-11 08:24:00 +00:00
deviceauth feat(oidc): sid claim for id_tokens issued through login V1 (#8525) 2024-09-03 13:19:00 +00:00
execution feat(v3alpha): write actions (#8225) 2024-07-31 14:42:12 +02:00
feature perf(oidc): disable push of user token meta-event (#8691) 2024-09-26 13:55:41 +00:00
flow refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
idp feat(saml): allow setting nameid-format and alternative mapping for transient format (#7979) 2024-05-23 05:04:07 +00:00
idpconfig refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
idpintent fix(setup): init projections (#7194) 2024-01-25 17:28:20 +01:00
instance feat: Add Twilio Verification Service (#8678) 2024-09-26 09:14:33 +02:00
keypair feat(v3alpha): web key resource (#8262) 2024-08-14 14:18:14 +00:00
limits fix(setup): init projections (#7194) 2024-01-25 17:28:20 +01:00
member refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
metadata refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
milestone fix(setup): init projections (#7194) 2024-01-25 17:28:20 +01:00
oidcsession perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
org perf(import): optimize search for domains claimed by other organizations (#8200) 2024-07-05 09:36:00 +02:00
policy feat(cnsl): docs link can be customized and custom button is available (#7840) 2024-05-13 16:01:50 +02:00
project fix(oidc): don't push introspection client events (#8481) 2024-08-28 18:19:50 +00:00
pseudo feat: push telemetry (#6027) 2023-07-06 08:38:13 +02:00
quota fix(setup): init projections (#7194) 2024-01-25 17:28:20 +01:00
restrictions fix(setup): init projections (#7194) 2024-01-25 17:28:20 +01:00
session feat: Add Twilio Verification Service (#8678) 2024-09-26 09:14:33 +02:00
settings refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
target feat: add action v2 execution on requests and responses (#7637) 2024-05-04 11:55:57 +02:00
user feat: Add Twilio Verification Service (#8678) 2024-09-26 09:14:33 +02:00
usergrant refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
webkey feat(v3alpha): web key resource (#8262) 2024-08-14 14:18:14 +00:00