[ 
https://issues.apache.org/jira/browse/GEODE-1897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16271456#comment-16271456
 ] 

ASF GitHub Bot commented on GEODE-1897:
---------------------------------------

davebarnes97 closed pull request #1098: GEODE-1897 Docs:  configure eviction 
through gfsh
URL: https://github.com/apache/geode/pull/1098
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/geode-docs/developing/eviction/configuring_data_eviction.html.md.erb 
b/geode-docs/developing/eviction/configuring_data_eviction.html.md.erb
index 530c22f88c..e477d6d982 100644
--- a/geode-docs/developing/eviction/configuring_data_eviction.html.md.erb
+++ b/geode-docs/developing/eviction/configuring_data_eviction.html.md.erb
@@ -28,7 +28,7 @@ Configure data eviction as follows. You do not need to 
perform these steps in th
 
 1.  Decide whether to evict based on:
     -   Entry count (useful if your entry sizes are relatively uniform).
-    -   Total bytes used. In partitioned regions, this is set using 
`local-max-memory`. In non-partitioned, it is set in `eviction-attributes`.
+    -   Total bytes used. In partitioned regions, this is set using 
`local-max-memory`. In non-partitioned regions, it is set in 
`eviction-attributes`.
     -   Percentage of application heap used. This uses the 
<%=vars.product_name%> resource manager. When the manager determines that 
eviction is required, the manager orders the eviction controller to start 
evicting from all regions where the eviction algorithm is set to 
`lru-heap-percentage`. Eviction continues until the manager calls a halt. 
<%=vars.product_name%> evicts the least recently used entry hosted by the 
member for the region. See [Managing Heap and Off-heap 
Memory](../../managing/heap_use/heap_management.html#resource_manager).
 
 2.  Decide what action to take when the limit is reached:
@@ -38,51 +38,26 @@ Configure data eviction as follows. You do not need to 
perform these steps in th
 3.  Decide the maximum amount of data to allow in the member for the eviction 
measurement indicated. This is the maximum for all storage for the region in 
the member. For partitioned regions, this is the total for all buckets stored 
in the member for the region - including any secondary buckets used for 
redundancy.
 4.  Decide whether to program a custom sizer for your region. If you are able 
to provide such a class, it might be faster than the standard sizing done by 
<%=vars.product_name%>. Your custom class must follow the guidelines for 
defining custom classes and, additionally, must implement 
`org.apache.geode.cache.util.ObjectSizer`. See [Requirements for Using Custom 
Classes in Data 
Caching](../../basic_config/data_entries_custom_classes/using_custom_classes.html).
 
-**Note:**
-You can also configure Regions using the gfsh command-line interface, however, 
you cannot configure `eviction-attributes` using gfsh. See [Region 
Commands](../../tools_modules/gfsh/quick_ref_commands_by_area.html#topic_EF03119A40EE492984F3B6248596E1DD)
 and [Disk Store 
Commands](../../tools_modules/gfsh/quick_ref_commands_by_area.html#topic_1ACC91B493EE446E89EC7DBFBBAE00EA).
-
-Examples:
-
-``` pre
-// Create an LRU memory eviction controller with max bytes of 1000 MB
-// Use a custom class for measuring the size of each object in the region 
-<region-attributes refid="REPLICATE"> 
-  <eviction-attributes> 
-    <lru-memory-size maximum="1000" action="overflow-to-disk"> 
-      <class-name>com.myLib.MySizer</class-name> 
-      <parameter name="name"> 
-        <string>Super Sizer</string> 
-      </parameter> 
-    </lru-memory-size> 
-  </eviction-attributes> 
-  </region-attributes>
-```
+**Examples:**
 
-``` pre
-// Create a memory eviction controller on a partitioned region with max bytes 
of 512 MB
-<region name="demoPR">
-  <region-attributes refid="PARTITION">
-    <partition-attributes local-max-memory="512" total-num-buckets="13"/>
-    <eviction-attributes>
-       <lru-memory-size action="local-destroy"/>
-       <class-name>org.apache.geode.cache.util.ObjectSizer
-       </class-name>
-    </eviction-attributes>
-  </region-attributes>
-</region>
-            
-```
+Create an LRU memory eviction controller with a maximum limit of 1000 MB. Use 
a custom class for measuring the size of each object in the region:
 
-``` pre
-// Configure a partitioned region for heap LRU eviction. The resource manager 
controls the limits. 
-<region-attributes refid="PARTITION_HEAP_LRU"> 
-</region-attributes>
 ```
+gfsh>create region --name=myRegion --type=REPLICATE --eviction-max-memory=1000 
\
+--eviction-action=overflow-to-disk --eviction-object-sizer=com.myLib.MySizer
+```
+
+Create a memory eviction controller on a partitioned region with a maximum 
entry count of 512:
 
-``` pre
-Region currRegion = cache.createRegionFactory()
-    
.setEvictionAttributes(EvictionAttributes.createLRUHeapAttributes(EvictionAction.LOCAL_DESTROY))
-    .create("root");
+```
+gfsh>create region --name=myRegion --type=PARTITION --eviction-entry-count=512 
\
+--eviction-action=overflow-to-disk 
 ```
 
+To configure a partitioned region for heap LRU eviction, first configure the 
resource manager on server startup, then create a region with eviction enabled:
 
+```
+gfsh>start server --name=Server1 --eviction-heap-percentage=80
+...
+gfsh>create region --type=PARTITION --eviction-enabled 
--eviction-action=overflow-to-disk
+```
diff --git a/geode-docs/tools_modules/gfsh/command-pages/create.html.md.erb 
b/geode-docs/tools_modules/gfsh/command-pages/create.html.md.erb
index 077cdb0f90..d5cc5cce9f 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/create.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/create.html.md.erb
@@ -751,7 +751,8 @@ See [Region Data Storage and 
Distribution](../../../developing/region_options/ch
     [--recovery-delay=value] [--redundant-copies=value]
     [--startup-recovery-delay=value] [--total-max-memory=value]
     [--total-num-buckets=value] [--compressor=value] [--off-heap(=value)]
-    [--partition-resolver=value]
+    [--partition-resolver=value] [--eviction-enabled] 
[--eviction-entry-count=value]
+    [--eviction-max-memory=value] [--eviction-action=value] 
[--eviction-object-sizer=value]
 ```
 
 **Parameters, create region:**
@@ -960,6 +961,48 @@ See [Region Data Storage and 
Distribution](../../../developing/region_options/ch
 <td><span class="keyword parmname">\-\-partition-resolver</span></td>
 <td>Specifies the full path to a custom partition resolver. To use the 
provided default partition resolver, specify <code class="ph 
codeph">org.apache.geode.cache.util.StringPrefixPartitionResolver</code>.</td>
 <td></td>
+</tr>
+<tr>
+<td><span class="keyword parmname">\-\-eviction-enabled</span></td>
+<td>Enables eviction, where the eviction policy is controlled by the resource 
manager based on heap percentage.</td>
+<td></td>
+</tr>
+<tr>
+<td><span class="keyword parmname">\-\-eviction-entry-count</span></td>
+<td>Enables eviction, where the eviction policy is based on the number of 
entries in the region.</td>
+<td></td>
+</tr>
+<tr>
+<td><span class="keyword parmname">\-\-eviction-max-memory</span></td>
+<td>Enables eviction, where the eviction policy is based on the amount of 
memory consumed by the region, specified in megabytes.</td>
+<td></td>
+</tr>
+<tr>
+<td><span class="keyword parmname">\-\-eviction-action</span></td>
+<td>Action to take when the eviction threshold is reached.
+<div class="p">
+<table>
+<tbody>
+<tr class="odd">
+<td>local-destroy</td>
+<td>Entry is destroyed locally. Use with caution - may lead to 
inconsistencies.</td>
+</tr>
+<tr class="even">
+<td>overflow-to-disk</td>
+<td>Entry is overflowed to disk. For partitioned regions, this provides the 
most reliable read behavior across the region.</td>
+</tr>
+</tbody>
+</table>
+</div>
+</td>
+<td></td>
+</tr>
+<tr>
+<td><span class="keyword parmname">\-\-eviction-object-sizer</span></td>
+<td>Specifies your implementation of the ObjectSizer interface to measure the 
size of objects in the region.
+The sizer applies only to heap and memory based eviction.</td>
+<td></td>
+</tr>
 </tbody>
 </table>
 
@@ -977,13 +1020,17 @@ create region --name=region2 --type=REPLICATE \
 org.apache.geode.examples.MyCacheListener2 \
 --group=Group1,Group2
 
-create region --name=region3 --type=PARTITION_PERSISTENT --redundant-copies=2 
--total-max-memory=1000 \
---startup-recovery-delay=5 --total-num-buckets=100 --disk-store=DiskStore2 \
---cache-listener=org.apache.geode.examples.MyCacheListener3 \
+create region --name=region3 --type=PARTITION_PERSISTENT --redundant-copies=2 \
+--total-max-memory=1000 --startup-recovery-delay=5 --total-num-buckets=100 \
+--disk-store=DiskStore2 
--cache-listener=org.apache.geode.examples.MyCacheListener3 \
 --group=Group2 
 
-create region --name=region4 --type=REPLICATE_PROXY 
--cache-listener=org.apache.geode.examples.MyCacheListener1 
---group=Group1,Group2
+create region --name=region4 --type=REPLICATE_PROXY \
+--cache-listener=org.apache.geode.examples.MyCacheListener1 
--group=Group1,Group2
+
+create region --name=myRegion --type=REPLICATE --eviction-max-memory=100 \
+--eviction-action=overflow-to-disk 
--eviction-object-sizer=my.company.geode.MySizer
+
 ```
 
 **Sample Output:**


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Users should be able to configure eviction through gfsh
> -------------------------------------------------------
>
>                 Key: GEODE-1897
>                 URL: https://issues.apache.org/jira/browse/GEODE-1897
>             Project: Geode
>          Issue Type: Sub-task
>          Components: docs, gfsh
>            Reporter: Swapnil Bawaskar
>            Assignee: Dave Barnes
>             Fix For: 1.4.0
>
>
> While creating a region in gfsh, users should be able to configure eviction 
> for that region.
> All three modes of eviction should be supported:
> 1. Eviction driven by the resource manager:
> {noformat}
> gfsh>create region --name=myRegion --type=REPLICATE --eviction-enabled
> {noformat}
> 2. eviction driven by entry count in the region:
> {noformat}
> gfsh>create region --name=myRegion --type=REPLICATE 
> --eviction-entry-count=1000
> {noformat}
> 3. eviction driven by bytes used:
> {noformat}
> gfsh>create region --name=myRegion --type=REPLICATE --eviction-max-memory=100
> (value in megabytes)
> {noformat}
> And also specify the eviction action as
> {noformat}
> --eviction-action=overflow-to-disk or
> --eviction-action=local-destroy
> {noformat}
> and an object sizer, so that users can plug-in custom object sizes as
> {noformat}
> --eviction-object-sizer=my.company.geode.MySizer
> {noformat}
> the sizer should only apply to heap and memory based eviction.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to