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

Reduce Data Transfer for State Restore #2872

Merged
merged 2 commits into from
Aug 18, 2024
Merged

Reduce Data Transfer for State Restore #2872

merged 2 commits into from
Aug 18, 2024

Conversation

tabuna
Copy link
Member

@tabuna tabuna commented Aug 11, 2024

This PR introduces a significant change to how screen state is handled. To better understand this, let’s first review the current behavior:

All recorded public properties of the screen are wrapped in a signalizer, which typically increases the length of the data since its contents are serialized:

// Serialized:
O:7:"Example":2:{s:9:"property1";s:6:"value1";s:9:"property2";s:6:"value2";}

The data is then encrypted, further increasing the text length:

// Encripted:
Tzo3OiJFeGFtcGxlIjoxOntzOjk6InByb3BlcnR5MSI7czo2OiJ2YWx1MSI7czo5OiJwcm9wZXJ0eTIiO3M6Njoi dmFsdWUiO30=

As a result, if a user writes too much data into a public property, such as a model with many relationships, this impacts the length of the response/request. In extreme cases, this can lead to a 413 – Request Entity Too Large error.

To address this issue while retaining functionality, this PR proposes the following change:

Instead of serializing the entire model and its properties, we will serialize the SQL query, similar to how Laravel Queues handle this with the SerializeModel trait. This approach will significantly reduce the amount of data transferred, as it avoids storing the complete information. During deserialization, the data will be retrieved again from the database.

This change aims to preserve functionality while mitigating the risk of data overload issues.

@tabuna tabuna changed the title State restore Reduce Data Transfer for State Restore Aug 11, 2024
@tabuna tabuna merged commit ec699cc into master Aug 18, 2024
1 check passed
@tabuna tabuna deleted the state_restore branch August 18, 2024 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant