[jboss-jira] [JBoss JIRA] (WFLY-11898) Add ability to group distributed session attributes to avoid cost of SESSION granularity

Paul Ferraro (Jira) issues at jboss.org
Tue Mar 26 10:39:01 EDT 2019


     [ https://issues.jboss.org/browse/WFLY-11898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Ferraro updated WFLY-11898:
--------------------------------
    Description: 
Since SESSION granularity requires the replication of *all* session attribute if *any* attribute was modified in a given request, most distributed web applications should leverage ATTRIBUTE granularity whenever to possible to reduce the replication payload costs per request.

However, if session attribute contains any reference to another session attribute, they are forced to use SESSION granularity to avoid losing referential integrity on failover and duplication of serialized data.

The proposal is to allow users the ability to annotate their session attribute classes such that they can group specific attribute together, while still being able to leverage ATTRIBUTE granularity for the remainder of their session attributes.

>From the user's perspective, I envision something like this:

{code:java}
@SessionAttributeGroup("order")
public class Order implements Serializable {
    List<OrderItem> items;
}

@SessionAttributeGroup("order")
public class OrderItem implements Serializable {
    //...
}
{code}

Thus the code:

{code:java}
session.setAttribute("order", order);
session.setAttribute("customized-item", item);
{code}

will result in both attributes being store within a single cache entry.
Internally, we use the @SessionAttributeGroup as the attribute name, and a Map<String, Object> as the attribute value, keyed by the actual attribute name.

  was:
Since SESSION granularity requires the replication of *all* session attribute if *any* attribute was modified in a given request, most distributed web applications should leverage ATTRIBUTE granularity whenever to possible to reduce the replication payload costs per request.

However, if session attribute contains any reference to another session attribute, they are forced to use SESSION granularity to avoid losing referential integrity on failover and duplication of serialized data.

The proposal is to allow users the ability to annotate their session attribute classes such that they can group specific attribute together, while still being able to leverage ATTRIBUTE granularity for the remainder of their session attributes.

>From the user's perspective, I envision something like this:

@SessionAttributeGroup("order")
public class Order implements Serializable {
    List<OrderItem> items;
}

@SessionAttributeGroup("order")
public class OrderItem implements Serializable {
    //...
}

Thus the code:

session.setAttribute("order", order);
session.setAttribute("customized-item", item);

will result in both attributes being store within a single cache entry.
Internally, we use the @SessionAttributeGroup as the attribute name, and a Map<String, Object> as the attribute value, keyed by the actual attribute name.



> Add ability to group distributed session attributes to avoid cost of SESSION granularity
> ----------------------------------------------------------------------------------------
>
>                 Key: WFLY-11898
>                 URL: https://issues.jboss.org/browse/WFLY-11898
>             Project: WildFly
>          Issue Type: Feature Request
>          Components: Clustering
>    Affects Versions: 16.0.0.Final
>            Reporter: Paul Ferraro
>            Assignee: Paul Ferraro
>            Priority: Major
>
> Since SESSION granularity requires the replication of *all* session attribute if *any* attribute was modified in a given request, most distributed web applications should leverage ATTRIBUTE granularity whenever to possible to reduce the replication payload costs per request.
> However, if session attribute contains any reference to another session attribute, they are forced to use SESSION granularity to avoid losing referential integrity on failover and duplication of serialized data.
> The proposal is to allow users the ability to annotate their session attribute classes such that they can group specific attribute together, while still being able to leverage ATTRIBUTE granularity for the remainder of their session attributes.
> From the user's perspective, I envision something like this:
> {code:java}
> @SessionAttributeGroup("order")
> public class Order implements Serializable {
>     List<OrderItem> items;
> }
> @SessionAttributeGroup("order")
> public class OrderItem implements Serializable {
>     //...
> }
> {code}
> Thus the code:
> {code:java}
> session.setAttribute("order", order);
> session.setAttribute("customized-item", item);
> {code}
> will result in both attributes being store within a single cache entry.
> Internally, we use the @SessionAttributeGroup as the attribute name, and a Map<String, Object> as the attribute value, keyed by the actual attribute name.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list