Configuring a Client/Server System
Configure your server and client processes and data regions to run your client/server system.
Prerequisites - Configure your server system using locators for member discovery. See Configuring Peer-to-Peer Discovery and Managing a Peer or Server Cache. - Configure your clients as standalone applications. See Managing a Client Cache. - Be familiar with cache region configuration. See Data Regions. - Be familiar with server and client configuration properties. See cache.xml.
Configure servers to listen for clients by completing one or both of the following tasks.
Configure each application server as a server by specifying the
<cache-server>element in the application’s
cache.xmland optionally specifying a non-default port to listen on for client connections.
<cache-server port="40404" ... />
Optional. Configure each
cacheserverprocess with a non-default port to listen on for client connections.
prompt> cacheserver start -port="44454"
Configure clients to connect to servers. In the client
cache.xml, use the server system’s locator list to configure your client server pools and configure your client regions to use the pools. For example:
<client-cache> <pool name="publisher" subscription-enabled="true"> <locator host="lucy" port="41111"/> <locator host="lucy" port="41111"/> </pool> ... <region name="clientRegion" ... <region-attributes pool-name="publisher" ...
You do not need to provide the complete list of locators to the clients at startup, but you should provide as complete a list as possible. The locators maintain a dynamic list of locators and servers and provide the information to the clients as needed.
Configure the server data regions for client/server work, following these guidelines. These do not need to be performed in this order.
Configure your server regions as partitioned or replicated, to provide a coherent cache view of server data to all clients. Note: If you do not configure your server regions as partitioned or replicated, you can get unexpected results with calls that check server region contents, such as
containsKeyOnServer. You might get only partial results, and you might also get inconsistent responses from two consecutive calls. These results occur because the servers report only on their local cache content and, without partitioned or replicated regions, they might not have a complete view of the data in their local caches.
When you define your replicated server regions, use any of the
RegionShortcutsettings except for
REPLICATE_PROXY. Replicated server regions must have
scope, and every server that defines the region must store data. The region shortcuts use
distributed-ackscope and all non-proxy settings store data.
When you define your partitioned server regions, use the
RegionShortcutoptions. You can have local data storage in some servers and no local storage in others.
When you start the server and client systems, the client regions will use the server regions for cache misses, event subscriptions, querying, and other caching activities.
What to do next
Configure your clients to use the cache and to subscribe to events from the servers as needed by your application. See Configuring Client/Server Event Messaging.