Skip to content

Fix cache keys of the metadata factories - #930

Merged
DanielBadura merged 1 commit into
3.22.xfrom
fix-metadata-cache-keys
Oct 7, 2026
Merged

DanielBadura merged 1 commit into
3.22.xfrom
fix-metadata-cache-keys

Conversation

@DanielBadura

Copy link
Copy Markdown
Member

The PSR-6 and PSR-16 metadata factories of aggregates, events and subscribers used the class name as cache key. Class names contain a backslash, which is a reserved character in PSR-6 and PSR-16, so the factories failed with any compliant cache like symfony/cache.

The class name is now hashed and prefixed per metadata type, so the factories can also share one cache. A cache hit is only accepted if it holds the expected metadata, for aggregates it also has to belong to the requested class.

The PSR-6 and PSR-16 metadata factories of aggregates, events and
subscribers used the class name as cache key. Class names contain a
backslash, which is a reserved character in PSR-6 and PSR-16, so the
factories failed with any compliant cache like symfony/cache.

The class name is now hashed and prefixed per metadata type, so the
factories can also share one cache. A cache hit is only accepted if it
holds the expected metadata, for aggregates it also has to belong to the
requested class.
@DanielBadura DanielBadura added this to the 3.22.1 milestone Oct 6, 2026
@DanielBadura DanielBadura self-assigned this Oct 6, 2026
@DanielBadura DanielBadura added the bug Something isn't working label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Hello 👋

here is the most recent benchmark result:

SplitStreamBench
================

+-------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
|                         | time (kde mode)                                     | memory                                     |
+-------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| subject                 | Tag: <current>     | Tag: base          | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+-------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| benchLoad10000Events () | 5.362ms (±0.00%)   | 5.587ms (±0.00%)   | -4.03%    | 36.165mb        | 36.172mb   | -0.02%      |
| benchSave10000Events () | 344.350ms (±0.00%) | 340.324ms (±0.00%) | +1.18%    | 35.656mb        | 36.174mb   | -1.43%      |
+-------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+

SubscriptionEngineBench
=======================

+---------------------------+-----------------+-----------------+-----------+-----------------+------------+-------------+
|                           | time (kde mode)                               | memory                                     |
+---------------------------+-----------------+-----------------+-----------+-----------------+------------+-------------+
| subject                   | Tag: <current>  | Tag: base       | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+---------------------------+-----------------+-----------------+-----------+-----------------+------------+-------------+
| benchHandle10000Events () | 3.135s (±0.00%) | 3.144s (±0.00%) | -0.30%    | 47.564mb        | 47.564mb   | 0.00%       |
+---------------------------+-----------------+-----------------+-----------+-----------------+------------+-------------+

NoopSubscriptionEngineBench
===========================

+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
|                           | time (kde mode)                                   | memory                                     |
+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
| subject                   | Tag: <current>    | Tag: base         | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
| benchHandle10000Events () | 79.564ms (±0.00%) | 78.983ms (±0.00%) | +0.73%    | 47.564mb        | 47.564mb   | 0.00%       |
+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+

SimpleSetupStreamStoreBench
===========================

+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
|                                        | time (kde mode)                                     | memory                                     |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| subject                                | Tag: <current>     | Tag: base          | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| benchLoad1Event ()                     | 1.174ms (±0.00%)   | 1.206ms (±0.00%)   | -2.62%    | 35.210mb        | 35.210mb   | 0.00%       |
| benchLoad10000Events ()                | 69.762ms (±0.00%)  | 69.108ms (±0.00%)  | +0.95%    | 35.210mb        | 35.210mb   | 0.00%       |
| benchSave1Event ()                     | 1.475ms (±0.00%)   | 1.441ms (±0.00%)   | +2.34%    | 35.210mb        | 35.210mb   | 0.00%       |
| benchSave10000Events ()                | 285.835ms (±0.00%) | 287.379ms (±0.00%) | -0.54%    | 35.210mb        | 35.210mb   | 0.00%       |
| benchSave10000Aggregates ()            | 7.387s (±0.00%)    | 7.494s (±0.00%)    | -1.43%    | 35.211mb        | 35.211mb   | 0.00%       |
| benchSave10000AggregatesTransaction () | 4.780s (±0.00%)    | 4.794s (±0.00%)    | -0.28%    | 35.211mb        | 35.211mb   | 0.00%       |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+

SubscriptionEngineBatchBench
============================

+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
|                           | time (kde mode)                                   | memory                                     |
+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
| subject                   | Tag: <current>    | Tag: base         | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
| benchHandle10000Events () | 82.399ms (±0.00%) | 79.861ms (±0.00%) | +3.18%    | 35.548mb        | 35.548mb   | 0.00%       |
+---------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+

SimpleSetupBench
================

+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
|                                        | time (kde mode)                                     | memory                                     |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| subject                                | Tag: <current>     | Tag: base          | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| benchLoad1Event ()                     | 1.228ms (±0.00%)   | 1.220ms (±0.00%)   | +0.64%    | 34.983mb        | 34.983mb   | 0.00%       |
| benchLoad10000Events ()                | 62.509ms (±0.00%)  | 61.976ms (±0.00%)  | +0.86%    | 34.983mb        | 34.983mb   | 0.00%       |
| benchSave1Event ()                     | 1.285ms (±0.00%)   | 1.245ms (±0.00%)   | +3.24%    | 34.983mb        | 34.983mb   | 0.00%       |
| benchSave10000Events ()                | 220.083ms (±0.00%) | 227.800ms (±0.00%) | -3.39%    | 34.983mb        | 34.983mb   | 0.00%       |
| benchSave10000Aggregates ()            | 7.134s (±0.00%)    | 7.057s (±0.00%)    | +1.09%    | 34.983mb        | 34.983mb   | 0.00%       |
| benchSave10000AggregatesTransaction () | 4.642s (±0.00%)    | 4.607s (±0.00%)    | +0.76%    | 34.983mb        | 34.983mb   | 0.00%       |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+

PersonalDataBench
=================

+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
|                                        | time (kde mode)                                     | memory                                     |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| subject                                | Tag: <current>     | Tag: base          | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+
| benchLoad1Event ()                     | 1.486ms (±0.00%)   | 1.524ms (±0.00%)   | -2.49%    | 35.589mb        | 35.589mb   | 0.00%       |
| benchLoad10000Events ()                | 92.974ms (±0.00%)  | 92.765ms (±0.00%)  | +0.23%    | 35.589mb        | 35.589mb   | 0.00%       |
| benchSave1Event ()                     | 1.849ms (±0.00%)   | 1.813ms (±0.00%)   | +1.97%    | 35.589mb        | 35.589mb   | 0.00%       |
| benchSave10000Events ()                | 253.328ms (±0.00%) | 273.192ms (±0.00%) | -7.27%    | 35.591mb        | 35.591mb   | 0.00%       |
| benchSave10000Aggregates ()            | 11.229s (±0.00%)   | 11.327s (±0.00%)   | -0.86%    | 35.589mb        | 35.589mb   | 0.00%       |
| benchSave10000AggregatesTransaction () | 8.690s (±0.00%)    | 8.707s (±0.00%)    | -0.19%    | 36.048mb        | 36.048mb   | 0.00%       |
+----------------------------------------+--------------------+--------------------+-----------+-----------------+------------+-------------+

SnapshotsBench
==============

+----------------------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
|                                        | time (kde mode)                                   | memory                                     |
+----------------------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
| subject                                | Tag: <current>    | Tag: base         | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+----------------------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+
| benchLoad10000EventsMissingSnapshot () | 62.830ms (±0.00%) | 61.646ms (±0.00%) | +1.92%    | 35.054mb        | 35.054mb   | 0.00%       |
| benchLoad10000Events ()                | 1.168ms (±0.00%)  | 1.147ms (±0.00%)  | +1.79%    | 35.054mb        | 35.054mb   | 0.00%       |
+----------------------------------------+-------------------+-------------------+-----------+-----------------+------------+-------------+

CommandToQueryBench
===================

+----------------+------------------+------------------+-----------+-----------------+------------+-------------+
|                | time (kde mode)                                 | memory                                     |
+----------------+------------------+------------------+-----------+-----------------+------------+-------------+
| subject        | Tag: <current>   | Tag: base        | time-diff | Tag: <current>  | Tag: base  | memory-diff |
+----------------+------------------+------------------+-----------+-----------------+------------+-------------+
| benchCreate () | 2.923ms (±0.00%) | 2.807ms (±0.00%) | +4.14%    | 4.980mb         | 4.980mb    | 0.00%       |
| benchUpdate () | 4.438ms (±0.00%) | 4.118ms (±0.00%) | +7.76%    | 4.986mb         | 4.986mb    | 0.00%       |
| benchBoth ()   | 7.641ms (±0.00%) | 7.117ms (±0.00%) | +7.36%    | 5.029mb         | 5.029mb    | 0.00%       |
+----------------+------------------+------------------+-----------+-----------------+------------+-------------+

This comment gets update everytime a new commit comes in!

@DanielBadura
DanielBadura merged commit 809e564 into 3.22.x Oct 7, 2026
39 checks passed
@DanielBadura
DanielBadura deleted the fix-metadata-cache-keys branch October 7, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants