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

Elastic Scaling #5591

Merged
merged 15 commits into from
Apr 2, 2024
77 changes: 77 additions & 0 deletions docs/learn/learn-elastic-scaling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
id: learn-elastic-scaling
title: Polkadot's Elastic Scaling
sidebar_label: Elastic Scaling
description: Pushing Parachains' Boundaries Below 6 seconds Execution Time.
filippoweb3 marked this conversation as resolved.
Show resolved Hide resolved
keywords: [elastic scaling, parachains, coretime, blockspace]
slug: ../learn-elastic-scaling
---

The path of parablocks from their creation to their inclusion into the relay chain (discussed in the
[Parachain Protocol Page](./learn-parachains-protocol.md)) span two domains: the parachain's and
relay chain's roles. Scaling the Polkadot protocol involves consideration of how parablocks are
validated, processed, secured, made available for additional checks, and finally included in the
relay chain as part of its final state
filippoweb3 marked this conversation as resolved.
Show resolved Hide resolved

[Asynchronous backing](./learn-async-backing.md) is the first implementation of the parachain
protocol that alters how parachains produce blocks and how the relay chain processes their data.
This upgrade will allow parachains to take up to 2 seconds execution time (for producing
parablocks), while the relay chain will be able to include a parablock every 6 seconds.
filippoweb3 marked this conversation as resolved.
Show resolved Hide resolved

With asynchronous backing enabled, parachains can theoretically produce parablocks in the sub-second
time range. However, to accomplish this, asynchronous backing must temporarily **hold** blocks in
[unincluded segments](./learn-async-backing.md#unincluded-segments), while parablocks can be
included into the relay chain every 6 seconds per core. This is the bottleneck that elastic scaling
DrW3RK marked this conversation as resolved.
Show resolved Hide resolved
addresses. With elastic scaling, parachains can use multiple cores to include multiple parablocks
within the same relay chain block.
filippoweb3 marked this conversation as resolved.
Show resolved Hide resolved

filippoweb3 marked this conversation as resolved.
Show resolved Hide resolved
Take, for example, a parachain that wants to submit four parablocks to the relay chain. Without
elastic scaling, it will take 24 seconds to include all of them through one core. Remember that a
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
core is occupied after backing and before inclusion, i.e., for the whole data availability process.
A block cannot enter a core before the previous block has been declared available.

```
R1 <----- R2 <----- R3 <----- R4 <----- R5

C1 |P1 B I
|P2 B I
|P3 B I
|P4 B I

```

The diagram above shows how the backing and inclusion of parablocks (P) happen within the same relay
chain block (R). With one core (C1), a parablock is included every 6 seconds. Note how P4 is
included after 30 seconds (not 24 seconds) because when P1 was pushed to the relay chain for being
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
backed, there was no previous parablock.

With elastic scaling, it will take just 12 seconds (3-second block time) to include all four
parablocks using two cores.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, if elastic scaling improves time in this manner, than naturally they would also have to pay more for this throughput ;)


```
R1 <----- R2 <----- R3
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved

C1 |P1 B I
|P2 B I
C2 |P3 B I
|P4 B I

```

The diagram above shows how four parablocks are backed and included in the relay chain using two
cores (C1 and C2). Note how P2 and P4 are included after 18 seconds (not 12 seconds) because when P1
and P3 were pushed to the relay chain for being backed, there were no other parablocks before them.

## Technical Considerations

If the pace per core on the relay chain will not change (backing and inclusion every 6 seconds per
core), on the parachain side, collators will need to increase the parablock production rate to push
P1 and P2 to the two relay chain cores.

Assuming a constant number of cores, from the relay chain side, elastic scaling will not see major
upgrades as a parachain will use multiple existing cores instead of just one. However, from the
parachain side, collators must produce more parablocks per unit of time, implying that technical
specifications for collators will likely increase.

For more advanced technical challenges, see the
[Elastic Scaling GitHub PR](https://github.com/paritytech/polkadot-sdk/issues/1829).
1 change: 1 addition & 0 deletions kusama-guide/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ module.exports = {
'learn/learn-spree',
"learn/learn-parathreads",
"learn/learn-async-backing",
"learn/learn-elastic-scaling",
"learn/learn-sassafras",
],
},
Expand Down
1 change: 1 addition & 0 deletions polkadot-wiki/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ module.exports = {
'learn/learn-spree',
"learn/learn-parathreads",
"learn/learn-async-backing",
"learn/learn-elastic-scaling",
"learn/learn-sassafras",
"learn/learn-hyperbridge",
],
Expand Down
Loading