You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GridField makes use of the session to store parameters required to trigger each action available on the grid (including a set of keys for the actions on each grid item). This works simply and effectively in basic use-cases, and if you use a traditional single-server hosting environment, you'd likely never notice any problems.
However, with the combination of two increasingly common factors, we quickly see issues with this approach:
The Queued Jobs module, which has a ModelAdmin that contains a significant number of GridField Actions
A cloud-based hosting environment with multiple web servers, utilising DynamoDB for session storage - which has limited Read / Write capacity that is measured both in the number and size of requests.
Loading the Queued Jobs ModelAdmin when at least a page worth of jobs exist stores approximately 40 session keys in my testing, weighing roughly 5kb. This may seem small, but it means a user who visits this interface once during their session will consume ~5 write units in DynamoDB on every request until they log out. With more complex projects that utilise a range of GridFields, this number will rise further.
We could improve this in one of two ways:
Ensure keys are purged once they are no longer relevant (i.e. once the user navigates to another interface)
Shift away from use of the session to store this data entirely (any reason we can't send it down to the user? CSRF concerns?)
The former is lower effort, and would be a big improvement - not significantly improving peak usage, but at least mitigating the general impact.
Steps to Reproduce
Install symbiote/silverstripe-queuedjobs
Create enough jobs to fill a page of the QueuedJobs ModelAdmin interface
Visit the ModelAdmin and observe excessive session use
Navigate around the CMS and observe the gf_ session keys are never cleared
Elemental uses a GridField to render the UI for editing blocks on a page. Each PageEdit view loaded by a user will write a set of gf_ keys to the session. On a site with a large number of pages and blocks, it's possible to reach a session size of 100KB+ - which makes scaling DynamoDB to work around the issue prohibitively expensive, and would likely also have a performance impact even in traditional hosting environment configurations.
Affected Version
Tested against SilverStripe 4.3.x-dev
Description
GridField makes use of the session to store parameters required to trigger each action available on the grid (including a set of keys for the actions on each grid item). This works simply and effectively in basic use-cases, and if you use a traditional single-server hosting environment, you'd likely never notice any problems.
However, with the combination of two increasingly common factors, we quickly see issues with this approach:
Loading the Queued Jobs ModelAdmin when at least a page worth of jobs exist stores approximately 40 session keys in my testing, weighing roughly 5kb. This may seem small, but it means a user who visits this interface once during their session will consume ~5 write units in DynamoDB on every request until they log out. With more complex projects that utilise a range of GridFields, this number will rise further.
We could improve this in one of two ways:
The former is lower effort, and would be a big improvement - not significantly improving peak usage, but at least mitigating the general impact.
Steps to Reproduce
symbiote/silverstripe-queuedjobs
gf_
session keys are never clearedRelated PRs
The text was updated successfully, but these errors were encountered: