Note: This feature is experimental and is subject to change in future releases of VMware GemFire®.
The VMware GemFire Redis adapter allows VMware GemFire to function as a drop-in replacement for a Redis data store, letting Redis applications take advantage of VMware GemFire’s scaling capabilities without changing their client code. Redis clients connect to a VMware GemFire server in the same way they connect to a Redis server, using an IP address and a port number.
To use the Redis Adapter, you will need three pieces of information:
- The port number through which clients will communicate
- The IP address of the host where the server is to reside
- A choice of which attributes you will use for a VMware GemFire partitioned region
The IP address and port number should be the same ones coded in the Redis clients.
In order to take advantage of VMware GemFire’s scaling capabilities, you should specify the VMware GemFire region as one of the types that use the PARTITION data policy. PARTITION is the default. Other possibilities include PARTITION_REDUNDANT and PARTITION_PERSISTENT. (See “Region Shortcuts Quick Reference” for a complete list.)
To implement a VMware GemFire instance using the Redis Adapter:
- Install VMware GemFire on the system where the server is to reside.
- Use gfsh to start a VMware GemFire server, specifying the three configuration options described above:
--redis-portto specify the port. This parameter is required – the VMware GemFire server will listen on this port for Redis commands.
--redis-bind-addressto specify the IP address of the server host. This parameter is optional. If not specified, the default is determined from the /etc/hosts file.
--J=-Dgemfireredis.regiontypeto specify the region type. This parameter is optional. If not specified, regiontype is set to PARTITION.
gfsh> start server --name=server1 --redis-bind-address=localhost \ --redis-port=11211 --J=-Dgemfireredis.regiontype=PARTITION_PERSISTENT
Redis clients can then connect to the server at localhost:11211.
The VMware GemFire Redis Adapter supports all Redis data structures, including
In VMware GemFire these data structures are implemented using partitioned regions. In most cases, VMware GemFire allocates one partitioned region for each data structure. For example, each Sorted Set is allocated its own partitioned region, in which the key is the user data and the value is the user-provided score, and entries are indexed by score. The two exceptions to this design are data types String and HyperLogLog. All Strings are allocated to a single partitioned region. Similarly, all HyperLogLogs are allocated to a single region. Regions use VMware GemFire’s OQL and indexes.
The VMware GemFire Redis Adapter supports all Redis commands for each of the Redis data structures. (See the Javadocs for the GemFireRedisServer class for a detailed list.) The VMware GemFire server’s responses to Redis commands are identical to those of a Redis server with the following exceptions, resulting from VMware GemFire’s more extensive partitioning model:
- Any command that removes keys and returns a count of removed entries will return a count of how many entries have been removed from the local vm, rather than a total count of items removed across all members. However, all entries will be removed.
- Any command that returns a count of newly set members has an unspecified return value. The command will work just as the Redis protocol states, but the count will not necessarily reflect the number set compared to the number overridden.
- Transactions work just as they would on a Redis instance; they are local transactions. Transactions cannot be executed on data that is not local to the executing server, that is on a partitioned region in a different server instance, or that is on a persistent region that does not have transactions enabled. Also, you cannot watch or unwatch keys, as all keys within a VMware GemFire transaction are watched by default.
VMware GemFire’s primary advantage is its scalability. While the Redis server is single threaded, VMware GemFire supports high concurrency. Many Redis clients can execute commands on the VMware GemFire server simultaneously.
VMware GemFire supports stored procedures, which can execute on the server and report results to the requesting client.
VMware GemFire architecture and management features help detect and resolve network partitioning problems without explicit management on the part of the Redis client.
VMware GemFire WAN replication allows the data store to expand horizontally, across physically distant sites, while maintaining data consistency.