Solution 1: Stored Procedures (not the best in every case. . .) Pros: Place logic and data together Faster processing Simpler management Cons: Inflexible With 99.999% how often can you modify your schema? Question: How do I live without my database?
Trainer will provide handouts with the architectural blueprints.
You don’t want to see this in the papers, do you?
Linda model 1992 David Gelernter and Nicholas Carriero Java, Sun Microsystems released in 1995 Sun introduced Jini in July of 1998
Use this slide to explain the space model. The space can be used to provide variety of middleware services under simple set of 4 API’s Explain how the four API’s can be used for: Caching Messaging (why there is no need for different implementation for both scenarios), Describe how content based routing is achieved Parallel processing – don’t put too much emphasize on that part at this stage – there is a separate slide on that
Today’s Reality – Tier Based Architecture Separate technology implementation Bottlenecks in all areas where state is stored, architecture can’t scale linearly! Separate technology implementation Separate technology implementation bottlenecks bottlenecks
Traditional Architecture - path to complexity… (marktplaats.nl) Auction Owner Auction Service Bid Service Trade Service Info Service Timer Service Auction Service Bid Service Trade Service Info Service Timer Service T Bidder Validate Result Process Bid Bid Accepted Bid Result Process Trade Get Bid Result Place bid
Traditional Architecture - path to complexity… Business tier Back-up Back-up
Redundancy doubles network traffic
Bottlenecks are created
Latency is increased
Separate failover strategy and implementation for each tier
Bidder Auction Owner Auction Service Bid Service Trade Service Info Service Timer Service
Single, built-in failover/redundancy investment strategy
Fewer integration points mean fewer chances for failure
Primary Backup
Step 4 – Scale Processing Unit
Write Once Scale Anywhere:
Linear scalability
Single monitoring and management engine
Automated , SLA-Driven deployment and management
Scaling policy, System requirements, Space cluster topology
Backup Backup
Event Containers
Step 5 – Auto Scale Out
Processing Unit – Scalability Unit Single Processing Unit Processing Unit - Scaled Involves Config Change No code changes!
Processing Unit – High-Availability Unit Sync Replication Primary - Processing Unit Business logic – Active mode Backup - Processing Unit Business logic – Standby mode
Database Integration - Async persistency Sync Replication Primary - Processing Unit Business logic – Active mode Backup - Processing Unit Business logic – Standby mode Mirror Process ORM Initial Load Async Replication Async Replication
XAP = Enterprise Grade Middleware
Scale-out application server
End 2 End scale-out middleware for: Web, Data, Messaging, Business logic
Space Based Architecture – designed for scaling stateful applications In-memory
Unique database scaling solution that fits cloud environment
In Memory Data Grid
O/R mapping support
Support major Enterprise languages
Java, .Net, C++
Agenda
Preview
The Problem
The Solution
Event Containers
Example
Benchmarks
Customer Use Cases
Summary Q&A
Built-in Event Containers
Polling Container
Notify Container
Polling Container
Used for point-to-point messaging
Container polls the Space
for events
Comparable with the
way Ajax works
Notify Container
Used for publish-subscribe messaging
Space notifies the container
Typical Application
Service Grid Summary
Powerful Universal Container
Java/Net/C++
Distributed
Fault Tolerant
Object based
Transactional
Publish/Subscribe
Agenda
Preview
The Problem
The Solution
Event Containers
Example
Benchmarks
Customer Use Cases
Summary Q&A
Event Containers
The POJO Based Data Domain Model @SpaceClass(fifo=true) public class Data { … @SpaceId ( autoGenerate = true ) public String getId () { return id; } public String setId ( String id ) { this .id = id; } public void setProcessed ( boolean processed ) { this . processed = processed; } public boolean isProcessed ( boolean processed ) { return this . processed; } } SpaceClass indicate that this is a SpaceEntry – SpaceClass includes classlevel attributes such as FIFO,Persistent… SpaceId used to define the key for that entry.
Data Processor Service Bean @SpaceDataEvent to be called when an event is triggered. public class DataProcessor{ @SpaceDataEvent public Data processData ( Data data ) { … data . setProcessed ( true ) ; //updates the space return data; } } Updates the data in the Space.
Wiring Order Processor Service Bean through Spring <bean id=" dataProcessor “ class="com.gigaspaces.pu.example1.processor.DataProcessor" /> <os-events:polling-container id="dataProcessorPollingEventContainer" giga-space="gigaSpace"> <os-events:tx-support tx-manager="transactionManager"/> <os-core:template> <bean class="org.openspaces.example.data.common.Data"> <property name="processed" value="false"/> </bean> </os-core:template> <os-events:listener> <os-events:annotation-adapter> <os-events:delegate ref=" dataProcessor "/> </os-events:annotation-adapter> </os-events:listener> </os-events:polling-container> The event Template The event Listener
Data Feeder public class DataFeeder { public void feed(){ Data data = new Data(counter++); data.setProcessed( false ); //feed data gigaSpace.write(data); } } Feed Data
Remoting – Taking one step forward Event
Remoting – Taking one step forward Reduce
Remoting – IDataProcessor Service API public interface IDataProcessor { // Process a given Data object Data processData(Data data); }
Remoting - DataProcessor Service @RemotingService public class DataProcessor implements IDataProcessor { public Data processData(Data data) { … data.setProcessed( true ); return data; } }
Remoting - Order Feeder public class DataFeeder { private IDataProcessor dataProcessor; public void setDataProcessor(…) { this .dataProcessor = dataProcessor; } public Data feed(){ Data data = new Data(counter++); // remoting call return dataProcessor.process (data) } }
Summary
Agenda
Preview
The Problem
The Solution
Event Containers
Example
Benchmarks
Customer Use Cases
Summary Q&A
Scale up Throughput Benchmark – Physical Deployment Topology
Remote (multiple machines , multiple processes)
white box Client X4450 GigaSpaces 4 spaces , one per GSC X4450 GigaSpaces 4 spaces , one per GSC Switched Ethernet LAN Embedded (one machine , one process) X4450 Client GigaSpaces 8 spaces
Scale up Throughput Benchmark – Embedded mode 1.8 Million read sec! 1.1 Million write/take sec!
Query Notify Intercepts update events Game Servers Table Feeder
Loading Game Tables into the partitioned spaces
Randomly updates the game tables
Publisher (lobby)
Game Table Directory
Game Table search
Player search
Partitioned Space Pub/Sub messaging Scaling out GameTable Space Based Architecture – Game Server Publisher (II)
Publisher Servers Game Servers GigaSpaces Service Grid
Uploading 30,000 players for 6000 tables
Randomly updates game tables
Java runtime Physical backup
Running continues query per user
Space Based Architecture – Game Server Partitioned Space GameTable Partitioned Space GameTable Partitioned Space GameTable Notify / Query Notify / Query Partitioned Space GameTable Partitioned Space GameTable Partitioned Space GameTable
Dynamic repartitioning and load sharing I SLA Driven Container Indexed Notify / Query template Notify / Query template Partitioned Space Partitioned Space Partitioned Space
Dynamic repartitioning and load sharing II SLA Driven Container SLA Driven Container Partitioned Space Partitioned Space Partitioned Space
Scaling Throughput: ~6K/sec Throughput: ~12K/sec Throughput: ~18K/sec Partitioned Space Backup Space SLA Driven Container
6000 tables
30,000 players
SLA Driven Container Partitioned Space Backup Space
4000 tables
20,000 players
SLA Driven Container Partitioned Space Backup Space
2000 tables
10,000 players
Agenda
Preview
The Problem
The Solution
Event Containers
Example
Benchmarks
Customer Use Cases
Summary Q&A
Thank You! Q&A
Appendix
SLA Driven Deployment
SLA:
Failover policy
Scaling policy
Ststem requirements
Space cluster topology
PU Services beans definition
Continuous High Availability Fail-Over Failure
Dynamic Partitioning = Dynamic Capacity Growth VM 1 ,2G GSC VM 3 , 2G GSC VM 2 ,2G GSC Max Capacity=2G Max Capacity=4G Max Capacity=6G In some point VM 1 free memory is below 20 % - it about the time to increase the capacity – lets move Partitions 1 to another GSC and recover the data from the running backup! Later .. Partition 2 needs to move… After the move , data is recovered from the backup VM 5 , 4G GSC VM 4 ,4G GSC P - Primary B - Backup P P P B B B E F Partition 1 A B Partition 2 C D Partition 3 A B Partition 2 E F Partition 1 C D Partition 3
Executors
Task Executors – Task Execution
Executing a task is done using the execute method
AsyncFuture<Integer> future = gigaSpace .execute( new MyTask(2) ); int result = future.get(); 1 2 4 3
Task Executors – Task Routing
Routing a task can be done in three ways
1. Using the task itself
2. Passing a POJO to the execute method
3. Specifying a routing-parameter in the execute method
Task Executors – DistributedTask Execution
Executing a distributed task is done using the execute method
AsyncFuture<Integer> future = gigaSpace .execute( new MyDistTask() ); int result = future.get();
Task Executors – DistributedTask Routing
Routing a distributed task can be done
1. In the same ways as with the plain Task interface
2. By broadcasting
3. Specifying a number of routing-parameters in the execute method
Service Executors
Service Executors
IMDG
Operations
IMDG Basic Operations
IMDG Access – Space Operations – Write Operation
write -operation writes a new object to a space
Instantiate an object
Set fields as necessary
Write the object to the space
Auction auction = new Auction(); auction.setType( "Bicycle" ); gigaSpace.write(auction);
IMDG Access – Space Operations – Read Operation
read -operation reads an object from a space
A copy of the object is returned
The original copy remains in the space
Build a template/query (more on this later)
Read a matching object from the space
Auction template = new Auction(); Auction returnedAuction = gigaSpace.read(template);
Object SQL Query Support
Supported Options and Queries
Opeations: =, <>, <,>, >=, <=, [NOT] like, is [NOT] null, IN.
GROUP BY – performs DISTINCT on the POJO properties
Order By (ASC | DESC)
SQLQuery rquery = new SQLQuery(MyPojo.class,"firstName rlike '(a|c).*' or ago > 0 and lastName rlike '(d|k).*'");
Object[] result = space.readMultiple(rquery);
Dynamic Query Support
SQLQuery query = new SQLQuery(MyClass.class,“firstName = ? or lastName = ? and ago>?");
0 comments
Post a comment