Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming events #1808

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Streaming events #1808

wants to merge 7 commits into from

Conversation

ch1bo
Copy link
Member

@ch1bo ch1bo commented Jan 28, 2025

Changes I made originally for the hydra-doom project to load all events in state (12GB+ in that use case) with constant memory using conduit streams.

There is a big TODO on this: IOSim s does not have a MonadUnliftIO instance and its not impossible to have one. We need to change the interface further such that we can compose createHydraNode and hydrate functions with in-memory EventSource variants.

A bit of a wart: The mkProjection does run the conduit for each projection, instead we should run the conduit once and build the projected in-memory read/query model once.

Also, the change here is not constant-memory as the ServerOutput history is still kept fully in memory. But this is a different story and should be covered by #1618


  • CHANGELOG updated or not needed
  • Documentation updated or not needed
  • Haddocks updated or not needed
  • No new TODOs introduced or explained herafter

@ch1bo ch1bo requested a review from a team January 28, 2025 14:31
@ch1bo ch1bo force-pushed the streaming-events branch 4 times, most recently from f3762c6 to 53a0ff3 Compare January 28, 2025 16:10
Copy link

github-actions bot commented Jan 28, 2025

Transaction cost differences

No cost or size differences found

Copy link

github-actions bot commented Jan 28, 2025

Transaction costs

Sizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using arbitrary values and results are not fully deterministic and comparable to previous runs.

Metadata
Generated at 2025-02-04 18:46:54.994272593 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial c8a101a5c8ac4816b0dceb59ce31fc2258e387de828f02961d2f2045 2652
νCommit 61458bc2f297fff3cc5df6ac7ab57cefd87763b0b7bd722146a1035c 685
νHead 0e35115a2c7c13c68ecd8d74e4987c04d4539e337643be20bb3274bd 14756
μHead 57166715eadb8d3135964325c016eea546c21e1c0aae974ca67df9a5* 5541
νDeposit ae01dade3a9c346d5c93ae3ce339412b90a0b8f83f94ec6baa24e30c 1102
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per head.

Init transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 6091 10.98 3.42 0.53
2 6295 13.04 4.04 0.56
3 6496 15.37 4.76 0.59
5 6897 20.19 6.25 0.66
10 7904 30.97 9.53 0.82
40 13935 98.36 30.21 1.78

Commit transaction costs

This uses ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 558 2.44 1.16 0.20
2 743 3.38 1.73 0.22
3 918 4.36 2.33 0.24
5 1276 6.41 3.60 0.28
10 2177 12.13 7.25 0.40
54 10070 98.61 68.52 1.88

CollectCom transaction costs

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 525 25.67 7.41 0.43
2 114 636 35.89 10.22 0.54
3 171 751 45.82 12.99 0.65
4 227 862 56.25 15.85 0.76
5 284 969 65.33 18.43 0.85
6 336 1081 78.33 21.93 0.99
7 393 1192 89.09 25.03 1.10
8 449 1307 96.61 27.14 1.18

Cost of Increment Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 1818 25.03 8.22 0.49
2 2007 27.74 9.80 0.53
3 2147 29.19 10.93 0.56
5 2399 33.10 13.42 0.62
10 3212 45.04 20.71 0.80
37 7189 97.24 55.40 1.65

Cost of Decrement Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 623 23.95 7.61 0.43
2 735 24.81 8.48 0.44
3 873 26.53 9.62 0.47
5 1176 31.77 12.41 0.55
10 2185 47.47 20.05 0.77
39 5951 91.97 51.65 1.53

Close transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 716 29.15 9.22 0.48
2 833 33.51 11.22 0.54
3 948 32.78 11.64 0.54
5 1226 39.25 14.96 0.63
10 1954 49.71 21.56 0.79
36 5747 99.08 54.72 1.60

Contest transaction costs

Parties Tx size % max Mem % max CPU Min fee ₳
1 676 35.95 11.00 0.55
2 840 38.11 12.32 0.58
3 1006 40.95 13.93 0.63
5 1265 45.41 16.59 0.69
10 2010 57.43 23.72 0.87
27 4603 99.14 48.33 1.50

Abort transaction costs

There is some variation due to the random mixture of initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 5895 24.12 7.83 0.66
2 6095 37.39 12.32 0.81
3 6303 49.02 16.24 0.94
4 6324 56.08 18.45 1.01
5 6583 67.80 22.41 1.15
6 6664 73.09 24.15 1.21
7 6755 84.03 27.73 1.33
8 6822 91.28 30.07 1.40

FanOut transaction costs

Involves spending head output and burning head tokens. Uses ada-only UTXO for better comparability.

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
10 1 57 6125 22.38 7.49 0.65
10 10 569 6430 40.50 14.57 0.87
10 30 1707 7110 83.57 31.25 1.36
10 36 2048 7313 96.81 36.36 1.52

End-to-end benchmark results

This page is intended to collect the latest end-to-end benchmark results produced by Hydra's continuous integration (CI) system from the latest master code.

Please note that these results are approximate as they are currently produced from limited cloud VMs and not controlled hardware. Rather than focusing on the absolute results, the emphasis should be on relative results, such as how the timings for a scenario evolve as the code changes.

Generated at 2025-02-04 18:49:43.655420393 UTC

Baseline Scenario

Number of nodes 1
Number of txs 300
Avg. Confirmation Time (ms) 4.998232416
P99 9.671592719999994ms
P95 6.093833300000002ms
P50 4.8482485ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 900
Avg. Confirmation Time (ms) 24.112336945
P99 118.40399658ms
P95 31.67434695ms
P50 21.5728845ms
Number of Invalid txs 0

@noonio noonio linked an issue Feb 4, 2025 that may be closed by this pull request
3 tasks
@ch1bo ch1bo assigned v0d1ch and ch1bo Feb 4, 2025
ch1bo added 7 commits February 4, 2025 19:42
This requires MonadUnliftIO on hydrate and createNode functions to run
the conduits.

However, the io-sim tests' IOSim s monad does not have an instance!
This re-loading the same server outputs 3 times though.
Instead of running the conduits (which would require runResourceT), we
just construct the 'DraftHydraNode' directly.
Mistakenly used fuseBoth instead of zipSinks
This avoids redundant definitions at the cost of not having all
functions bound in the handle.
@ch1bo ch1bo requested a review from v0d1ch February 4, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review 👀
Development

Successfully merging this pull request may close these issues.

Constant memory API server history using StateEvents
3 participants