2. • Clients - in depth
• Function Execution
• Serialization
• Transactions
• Data Colocation
Agenda
2
3. • Client
• A process (Your Application)
connected to the Geode server(s)
• Can maintain near cache
• Run OQL queries on local data
• Can be notified about events on the
servers
3
Concepts
Application
GemFire Server
Region
Region
RegionClient Cache
4. • Client Notifications
• Register Interest
• Individual Keys OR RegEx for Keys
• Updates Local Copy
• Examples:
• region.registerInterest(“key-1”);
• region1.registerInterestRegex(“[a-z]+“);
• Continuous Query
• Receive Notification when Query condition met
on server
• Example:
• SELECT * FROM /tradeOrder t WHERE t.price > 100.00
• Can be DURABLE
Concepts
4
5. • Functions
• Used for distributed concurrent processing
(Map/Reduce, stored procedure)
• Push code vs pull data
• Run in Server’s process
• Highly available
• Member oriented
5
Concepts
Submit (f1)
f1 , f2 , … fn
Execute
Functions
11. But how fast is it?
Benchmark: https://github.com/eishay/jvm-serializers
12. Schema evolution
Member A Member B
Distributed Type Definitions
v2v1
Application #1
Application #2
v2 objects preserve data
from missing fields
v1 objects use default values to
fill in new fields
PDX provides forwards and backwards
compatibility, no code required
13. • Persistent Regions
• Durability
• WAL for efficient writing
• Consistent recovery
• Value always one disk seek away
• Compaction
13
Concepts
Modify
k1->v5
Create
k6->v6
Create
k2->v2
Create
k4->v4
Oplog2.crf
Member
1
Modify
k4->v7Oplog3.crf
Put k4->v7
Region
Cache
java.util.Map
JVM
Key Value
K01 May
K02 Tim
Region
Cache
java.util.Map
JVM
Key Value
K01 May
K02 Tim
Server 1 Server N
22. CacheTransactionManager mgr = cache.getCacheTransactionManager();
mgr.begin();
region1.put("K1", "V1");
region1.put("K2", "V2");
region2.put("K2", "V2");
mgr.commit();
Transaction - API
22
TransactionId txId = mgr.suspend();
… other non-transactional work
mgr.resume(txId);
mgr.tryResume(…);
region.putIfAbsent(K, V);
region.replace(K, V, V);
region.remove(K, V);
Single Entry
23. • Repeatable Read
• Thread sees own changes
• Other threads do not until commit is called
• Optimistic
• No Entry level locks, Readers not blocked
• Conflict Detection
• NOT Persistent (yet)
• Not a problem if you have at-least one member up
• Data must be colocated
Transaction - Semantics
23