| --- |
| title: Configuring Sockets in Multi-Site (WAN) Deployments |
| --- |
| |
| <!-- |
| 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. |
| --> |
| |
| When you determine buffer size settings, you try to strike a balance between communication needs and other processing. |
| |
| This table lists the settings for gateway relationships and protocols, and tells where to set them. |
| |
| <table> |
| <thead> |
| <tr class="header"> |
| <th>Protocol / Area Affected</th> |
| <th>Configuration Location</th> |
| <th>Property Name</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><strong>TCP / IP</strong></td> |
| <td>---</td> |
| <td>---</td> |
| </tr> |
| <tr> |
| <td>Gateway sender</td> |
| <td><code class="ph codeph">gfsh create gateway-sender</code> or |
| <p>cache.xml <gateway-sender></p></td> |
| <td>socket‑buffer‑size</td> |
| </tr> |
| <tr> |
| <td>Gateway receiver</td> |
| <td><code class="ph codeph">gfsh create gateway-receiver</code> or cache.xml <gateway-receiver></td> |
| <td>socket-buffer-size</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| **TCP/IP Buffer Sizes** |
| |
| If possible, your TCP/IP buffer size settings should match across your installation. At a minimum, follow the guidelines listed here. |
| |
| - **Multisite (WAN)**. In a multi-site installation using gateways, if the link between sites is not tuned for optimum throughput, it could cause messages to back up in the cache queues. If a receiving queue overflows because of inadequate buffer sizes, it will become out of sync with the sender and the receiver will be unaware of the condition. |
| |
| The gateway sender's socket-buffer-size attribute should match the gateway receiver’s socket-buffer-size attribute for all gateway receivers that the sender connects to, as in these example `cache.xml` snippets: |
| |
| ``` pre |
| Gateway Sender Socket Buffer Size cache.xml Configuration: |
| |
| <gateway-sender id="sender2" parallel="true" |
| remote-distributed-system-id="2" |
| socket-buffer-size="42000" |
| maximum-queue-memory="150"/> |
| |
| Gateway Receiver Socket Buffer Size cache.xml Configuration: |
| <gateway-receiver start-port="1530" end-port="1551" |
| socket-buffer-size="42000"/> |
| ``` |
| |
| **Note:** |
| WAN deployments increase the messaging demands on a <%=vars.product_name%> system. To avoid hangs related to WAN messaging, always set `conserve-sockets=false` for GemFire members that participate in a WAN deployment. |
| |
| ## <a id="socket_comm__section_4A7C60D4471A4339884AA5AAC97B4DAA" class="no-quick-link"></a>Multi-site (WAN) Socket Requirements |
| |
| Each gateway sender and gateway receiver uses a socket to distribute events or to listen for incoming connections from remote sites. |
| |
| <table> |
| <colgroup> |
| <col width="50%" /> |
| <col width="50%" /> |
| </colgroup> |
| <thead> |
| <tr class="header"> |
| <th>Multi-site Socket Description</th> |
| <th>Number Used</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><p>Listener for incoming connections</p></td> |
| <td><p>summation of the number of gateway-receivers defined for the member</p></td> |
| </tr> |
| <tr> |
| <td><p>Incoming connection</p></td> |
| <td><p>summation of the total number of remote gateway senders configured to connect to the gateway receiver</p></td> |
| </tr> |
| <tr> |
| <td><p>Outgoing connection</p></td> |
| <td><p>summation of the number of gateway senders defined for the member</p></td> |
| </tr> |
| </tbody> |
| </table> |
| |
| Servers are peers in their own clusters and have the additional socket requirements as noted in the Peer-to-Peer section above. |
| |
| ## <a id="socket_comm__section_66D11C8E84F941B58800EDB52194B087" class="no-quick-link"></a>Member produces SocketTimeoutException |
| |
| A client, server, gateway sender, or gateway receiver produces a `SocketTimeoutException` when it stops waiting for a response from the other side of the connection and closes the socket. This exception typically happens on the handshake or when establishing a callback connection. |
| |
| Response: |
| |
| Increase the default socket timeout setting for the member. This timeout is set separately for the client Pool and for the gateway sender and gateway receiver, either in the `cache.xml` file or through the API. For a client/server configuration, adjust the "read-timeout" value as described in [<pool>](../../reference/topics/client-cache.html#cc-pool) or use the `org.apache.geode.cache.client.PoolFactory.setReadTimeout` method. For a gateway sender or gateway receiver, see [WAN Configuration](../../reference/topics/elements_ref.html#topic_7B1CABCAD056499AA57AF3CFDBF8ABE3). |