| --- |
| title: How Distribution Works |
| --- |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| To use distributed and replicated regions, you should understand how they work and your options for managing them. |
| |
| <a id="how_distribution_works__section_2F892A4987C547E68CA78067133C2C2C"></a> |
| **Note:** |
| The management of replicated and distributed regions supplements the general information for managing data regions provided in [Basic Configuration and Programming](../../basic_config/book_intro.html). See also `org.apache.geode.cache.PartitionAttributes`. |
| |
| A distributed region automatically sends entry value updates to remote caches and receives updates from them. |
| |
| - Distributed entry updates come from the `Region` `put` and `create` operations (the creation of an entry with a non-null value is seen as an update by remote caches that already have the entry key). Entry updates are distributed selectively - only to caches where the entry key is already defined. This provides a pull model of distribution, compared to the push model that you get with replication. |
| - Distribution alone does not cause new entries to be copied from remote caches. |
| - A distributed region shares cache loader and cache writer application event handler plug-ins across the cluster. |
| |
| In a distributed region, new and updated entry values are automatically distributed to remote caches that already have the entries defined. |
| |
| **Step 1:** The application updates or creates the entry. At this point, the entry in the M1 cache may not yet exist. |
| |
| <img src="../../images_svg/distributed_how_1.svg" id="how_distribution_works__image_40EFE6E95E6945A1B08A68508ECBCC60" class="image" /> |
| |
| **Step 2:** The new value is automatically distributed to caches holding the entry. |
| |
| <img src="../../images_svg/distributed_how_2.svg" id="how_distribution_works__image_AF8A3ADEB5D94E20B101FDA92BF6D002" class="image" /> |
| |
| **Step 3:** The entry's value is the same throughout the cluster. |
| |
| <img src="../../images_svg/distributed_how_3.svg" id="how_distribution_works__image_5B1F06B54C9047E28A8C8673D1D5BD27" class="image" /> |
| |
| |