So, you have heard about in-memory computing but did not have time to deep dive into it nor had a chance to get acquainted with it in a commercial project? This session will try to identify the biggest challenges that are awaiting us in the world of distributed data processing. On the example of Hazelcast and its most popular features we will try to tackle the above-mentioned challenges right away. We will also have a closer look at the data structure offered by Hazelcast, their programming models and learn how to properly use them in our daily work. Finally, we will deep dive into caching. Don't miss this talk mate!
9. public class Employee {
private final Boolean active;
private final Integer age;
private final String name;
private final String surname;
private final Double salary;
}
RDBMS USE-CASE
12. DAO
MAP
...we could STORE THE DATA in a MAP
HazelcastInstance hz = Hazelcast.newHazelcastInstance();
Map<Integer, Employee> empls = hz.getMap("employees");
users.put(1, bond);
EMPLOYEE
22. QUERYING - PREDICATES
public Set<Employee> getWithNameOrAge( int age, double salary ) {
SqlPredicate query = new SqlPredicate(
"(age BETWEEN 25 AND 35) OR (salary < 50000)"
)
return employees.values( query );
}
23. INDEXES
IMap map = hazelcastInstance.getMap( "employees" );
// ordered, since we have ranged queries for this field
map.addIndex( "age", true );
// not ordered, because boolean field cannot have range
map.addIndex( "active", false );
24. I NEED THE DATA IN THE RDBMS FOR
REPORTING
http://www-01.ibm.com/software/data/bigdata/what-is-big-data.html
34. DATA AFFINITY
Node 1
Node 2
Node 3
MAP Salary
Address
Notes
Personal
James Bond
Salary
Address
Notes
Personal
Eathen Hunt
35. DATA AFFINITY: Storing
public class SalaryKey implements
Serializable, PartitionAware {
private final long employeeId;
private final long salaryId;
@Override
public Object getPartitionKey() {
return employeeId;
}
36. DATA AFFINITY: PROCESSING
public static class SalaryTask
implements Callable<Integer>,
PartitionAware, Serializable {
private long employeeId;
private long salaryId;
@Override
public Integer call() {
}
@Override
public Object getPartitionKey() {
return employeeId;
}
}
37. INTERCEPTOR
MAPINTERCEPTORS
Node 1
Node 2
Node 3
PUT
public interface MapInterceptor extends Serializable {
Object interceptPut( Object oldValue, Object newValue );
void afterPut( Object value );
}