[ 
https://issues.apache.org/jira/browse/GEODE-6922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Juan José Ramos Cassella updated GEODE-6922:
--------------------------------------------
    Description: 
The {{RegionSizeFunction}} is invoked within 
{{ClientServerSessionCache.size()}} as below:

{code:java}
public int size() {
    // Add a single dummy key to force the function to go to one server
    Set<String> filters = new HashSet<String>();
    filters.add("test-key");

    // Execute the function on the session region
    Execution execution = 
FunctionService.onRegion(getSessionRegion()).withFilter(filters);
    ResultCollector collector = execution.execute(RegionSizeFunction.ID);
    List<Integer> result = (List<Integer>) collector.getResult();

    // Return the first (and only) element
    return result.get(0);
  }
{code}

This makes the call to go to a single server every time, which may contribute 
to overload the member. Change the implementation to use 
{{Region.sizeOnServer()}} instead, the client will end up using any server on 
the pool and reduce the boiler plate around the execution.

  was:
The {{RegionSizeFunction}} is invoked within 
{{ClientServerSessionCache.size()}} as below:

{code:java}
public int size() {
    // Add a single dummy key to force the function to go to one server
    Set<String> filters = new HashSet<String>();
    filters.add("test-key");

    // Execute the function on the session region
    Execution execution = 
FunctionService.onRegion(getSessionRegion()).withFilter(filters);
    ResultCollector collector = execution.execute(RegionSizeFunction.ID);
    List<Integer> result = (List<Integer>) collector.getResult();

    // Return the first (and only) element
    return result.get(0);
  }
{code}

This makes the call to go to a single server every time, which may contribute 
to overload the member. The key should be randomly generated so the executions 
are spread around the available members.

        Summary: Session State Module - Use sizeOnServer instead of 
RegionSizeFunction  (was: Distribute the Execution of RegionSizeFunction Evenly 
Across Members)

> Session State Module - Use sizeOnServer instead of RegionSizeFunction
> ---------------------------------------------------------------------
>
>                 Key: GEODE-6922
>                 URL: https://issues.apache.org/jira/browse/GEODE-6922
>             Project: Geode
>          Issue Type: Bug
>          Components: http session
>            Reporter: Juan José Ramos Cassella
>            Assignee: Juan José Ramos Cassella
>            Priority: Major
>              Labels: GeodeCommons
>
> The {{RegionSizeFunction}} is invoked within 
> {{ClientServerSessionCache.size()}} as below:
> {code:java}
> public int size() {
>     // Add a single dummy key to force the function to go to one server
>     Set<String> filters = new HashSet<String>();
>     filters.add("test-key");
>     // Execute the function on the session region
>     Execution execution = 
> FunctionService.onRegion(getSessionRegion()).withFilter(filters);
>     ResultCollector collector = execution.execute(RegionSizeFunction.ID);
>     List<Integer> result = (List<Integer>) collector.getResult();
>     // Return the first (and only) element
>     return result.get(0);
>   }
> {code}
> This makes the call to go to a single server every time, which may contribute 
> to overload the member. Change the implementation to use 
> {{Region.sizeOnServer()}} instead, the client will end up using any server on 
> the pool and reduce the boiler plate around the execution.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to