SlideShare a Scribd company logo
JBoss 인피니스팬
데이터그리드 플랫폼 따라잡기
전재홍/JBoss User Group
인메모리 데이터그리드
Distributed Cache
• Fast access to data
• Performance boost
• Elasticity
• High Availability
• JSR 107 (Temporary Caching for the Java Platform)
– Read, write, expiration, write-through, distribution
Distributed Cache (cont.)
Persistence
(Database)
Distributed
Cache
Cluster
Node
Node
Node
App
App
App
In-Memory Data Grid
• Evolution of distributed caches
• Clustered by nature (shared across multiple servers)
• Low response time
• High throughput
• Predictable scalability
• High Availability
• Querying
• Task Execution (Map/Reduce)
• JSR 347 (Data Grid for the Java Platform)
In-Memory Data Grid (cont.)
Persistence
(DataStore)
In-Memory
Data Grid
Node
Node
Node
App
App
App
IMDG for What?
• Sharing data (session, app states)
• Toolkit for clustering
• Performance (caching, in-memory processing)
• Scalability
• Database on cloud
Players
• Oracle Coherence
• GridGain
• HazelCast
• IBM eXtreme Scale
• GigaSpaces
• VmWare GemFire
• Terracotta
• ScaleOut StateServer
• JBoss Infinispan
Cache vs. Data Grid
• JSR 107 - Temporary Caching for the Java Platform
– Basic interaction(read, write, expiry)
– Transactions with JTA compatibility
– Listener
– Persistence: read-through, write-through, write-behind
– Annotations
– javax.cache.*
• JSR 347 - Data Grids for the Java Platform
– Asynchronous, non-blocking API
– Distributed code execution and map/reduce API
– Group API for co-location
– Annotations (CDI)
– Eventually Consistent API
– Querying
– Configuration
– javax.datagrid.*
인피니스팬
Infinispan
• Distributed in-memory key/value data grid and
cache
• Distributed as library and server
• Manageable
• Open Source
DefaultCacheManager manager = new DefaultCacheManager();
// Cache<Integer, Ticket> cache = manager.getCache();
Cache<Integer, Ticket> cache =
manager.getCache(“myCache”);
Architecture: as library
Embedded library on the same JVM with Application
Infinispan
JVM
App
Architecture: as library, clustered
Cluster
Infinispan
JVM
App
Infinispan
JVM
App
Infinispan
JVM
App
Application doesn’t know it’s on cluster
l Use as library
– More features
– Richer APIs
– Programmatic/
Declarative
configuration
– Extendable/
embeddable
– Faster (API call)
Architecture: as server, clustered
• Use as server
– Remote
– Data tier shared by
multi-apps
– App doesn’t affect
cluster
– Non-java clients
• C++, .NET, Ruby
, Python, Java
Cluster
Infinispan
JVM
Infinispan
JVM
Infinispan
JVM
App
App
App
Architecture: multi clusters
• Multi-clusters
– By replication
– By persistence
– By replication
to other clust
er (topology a
ware)
Cluster
Infinispan
JVM
Infinispan
JVM
Cluster
Infinispan
JVM
Infinispan
JVM
persistence
Clustering
• Peer-to-Peer
– No central master, no single point of failure, no single
bottle neck
• JGroups
– Reliable multicast communication library, nodes
discovery, sharing data, performing cluster scaling
• Consistent Hash
– Hash based data distribution
– How it finds where data locates
• Linear in nature: throughput, capacity
Cluster Mode: Replication(복제)
Replication Mode
Cache on
Server 1
K,V
Cache on
Server 2
K,V
Cache on
Server 4
K,V
Cache on
Server 3
K,V
cache.put(K,V)
Cluster Mode: Distribution(분산)
Distribution Mode(numOwners=2)
Cache on
Server 1
K,V
Cache on
Server 2
K,V
Cache on
Server 4
Cache on
Server 3
cache.put(K,V)
cache.get(K,V)
Cluster Mode: Invalidation(무효화)
Invalidation Mode
Cache on
Server 1 K,V2
Cache on
Server 2
K,V
Cache on
Server 4
Cache on
Server 3
cache.put(K,V2)
DB
Persistence
• Used for durability
• Cache Store - Persistence Storage
– File System, Cloud, Remote, JDBC, JPA, LevelDB,
Cassandra, HBase, MongoDB, BerkeleyDB, JDBM, REST
• CacheLoader, CacheWriter
• Read-through, write-through, write-behind
• Passivation, activation
• Store chain
• Shared store
Persistence (cont.)
• Passivation – write to persistence when evicted
from memory (default)
• Activation – read to memory and remove from
persistence
Transaction
• JTA Transaction Support
• Support MVCC (Multi-Versioned Concurrency Control)
• Isolation Level
– READ_COMMITTED (default)
– REPEATABLE_READ
• Locking Mode
– Optimistic Lock (default)
– Pessimistic Lock
• Locking
– Lock timeout
– Lock striping
Query
• Query on values
• JBoss Hibernate Search + Apache Lucene
• Index Directory
– Lucene Directory: in-memory, file system, JDBC
– Infinispan Directory
• Distributed queries
Distributed Execution
• Executes codes on distributed nodes
• Through a standard JDK ExecutorService interface
• Use DistributedCallable extends
java.util.concurrent.Callable
Map/Reduce
• Based on Distributed Execution Framework
• Mapper, Reducer, Collator, MapReduceTask
public interface Callator<KOut, Vout, R> {
R collate(Map<KOut, VOut>);
}
public interface Mapper<KIn, VIn, KOut, VOut> extends Serializable {
void map(KIn key, VIn value, Collector<KOut, VOut> collector);
}
public interface Reducer<KOut, VOut> extends Serializable {
VOut reduce(KOut reducedKey, Iterator<VOut> iter);
}
Configuration: Declarative
• Eviction(제거)
– on the
memory
• Expiration(만료)
– on the cluster
<global>
<transport clusterName=“MyCacheCluster">
<properties>
<property name="configurationFile" value="jgroups-tcp.xml" />
</properties>
</transport>
<globalJmxStatistics enabled="true" />
</global>
<default>
<clustering mode="replication">
<sync />
</clustering>
</default>
<namedCache name="secureContextCache ">
<eviction strategy="LIRS" maxEntries="2000" />
<expiration lifespan="600000" />
<persistence passivation="false">
<store class="org.infinispan.persistence.file.SingleFileStore"
fetchPersistentState="false" preload="true" shared="false"
purgeOnStartup="true" ignoreModifications="false">
<async enabled="true" flushLockTimeout=“1000"
shutdownTimeout="3000" modificationQueueSize="1500" threadPoolSize="3" />
<properties>
<property name="location" value="${java.io.tmpdir}" />
</properties>
</store>
</persistence>
</namedCache>
Configuration: Programmatic
• Configuration Based on XML
• Programmatic configuration
DefaultCacheManager manager = new DefaultCacheManager("infinispan-config.xml");
Configuration baseConf = manager.getDefaultCacheConfiguration();
Configuration config =new ConfigurationBuilder().
read(baseConf).expiration().lifespan(50000).build();
manager.defineConfiguration(programmaticCache, config);
Cache<String, String> cache = manager.getCache("secureContextCache");
DefaultCacheManager manager = new DefaultCacheManager();
Configuration config = new ConfigurationBuilder()
.loaders()
.shared(false).passivation(false).preload(false)
.addCacheLoader()
.cacheLoader(new JdbcStringBasedCacheStore())
.addProperty("connectionFactoryClass","org.infinispan.loaders.jdbc
.connectionfactory.ManagedConnectionFactory")
.addProperty("datasourceJndiLocation", "java:jboss/datasources/MySQLDS")
.addProperty("userName", "root")
.addProperty("password", "admin")
.async().threadPoolSize(10).build();
manager.defineConfiguration(programmaticCache, config);
Cache<String, String> cache = manager.getCache("secureContextCache");
Listener
• Listener on CacheManager
– Node join/ leave, Cache start/ stop
• Cache
– CRUD, Eviction/ Passivation
– Rehashing/ Transaction completion
@Listener
public class SimpleListener {
@CacheEntryCreated
public void dataAdded(CacheEntryCreatedEvent event) {
if (event.isPre()) {
System.out.println("Before creating the entry:" + event.getKey());
} else {
System.out.println("After creating the entry:" + event.getKey());
}
…
}
DefaultCacheManager manager = new DefaultCacheManager();
manager.addListener(listener);
Cache<Integer, Ticket> cache = manager.getCache();
cache.addListener(listener);
Asynchronous APIs
• put() and get() and remove() are synchronous
– They wait for RPC and Locks (and maybe cache stores)
• The asynchronous API returns NotifyingFuture
– Events are fired on completion of the operation
NotifyingFuture<String> future = c.removeAsync(key);
future.attachListener(new FutureListener<String>() {
@Override
public void futureDone(Future<String> future) {
try {
future.get();
System.out.printf ("The entry stored under key %s has been removed.", key);
} catch (ExecutionException e) {
System.out.printf("Failed to remove %s!", key);
}
}
});
Spring Integration
• Infinispan provider for Spring cache abstraction
• infinispan-spring.jar
<cache:annotation-driven cache-manager=“myCacheManager"/>
<bean id="operationCacheManager"
class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean"
p:configurationFileLocation="classpath:infinispan -config.xml" />
@Cacheable(value = "secureContextCache", key="#contextId")
public SecureLayerContext getSecureLayerContext(String contextId) {
return null;
}
@CachePut(value = "secureContextCache", key="#contextId")
public SecureLayerContext setSecureLayerContext(String contextId,
SecureLayerContext secureLayerContext) {
return secureLayerContext;
}
@CacheEvict(value = "secureContextCache", key="#contextId")
public void removeSecureLayerContext(String contextId) {
// Intentionally blank
}
Customizing with Interceptors
• Infinispan follows Interceptor, Command/Visitor
design patterns
• Custom interceptor extends
BaseCustomInterceptor
Infinispan on JBoss AS 7 (WildFly 8)
• Used for session clustering, Hibernate L2 cache
• Application gets cache with JNDI name using
@Resource
• XML Configuration in server configuration file
<cache-container name="web" aliases="standard-session-cache" default-cache="repl">
<transport lock-timeout="60000" />
<replicated-cache name="repl" mode="ASYNC" batching="true">
<file-store />
</replicated-cache>
</cache-container>
Marshalling
• JBoss Marshalling framework used for POJOs
• User can provide custom Externalizer impls for
non-Serializable object
• Custome marshaller can be provided as well
Client Implementations
Monitoring/Management
• Mbeans on CacheManager, Cache
• RHQ (JON, JBoss Operations Network)
Radar Gun
• Data grid and distributed cache benchmarking
framework
• Built to test Infinispan and other distributed data
grid platforms
• https://github.com/radargun/radargun
적용 예
Use Cases: In Streaming Processing
Infinispan Data Grid
Use Cases: Data Grid Platform
In-Memory 대용량 데이터 처리를 위한 아키텍쳐 구조 제시 및 적용 사례,
제 6회 한국 소프트웨어 아키텍트 대회 최우수상, 2013
Use Case: Session Clustering
• Store session information into cache
in Spring MVC Interceptor
Case Study: Session Clustering
#1 Spring Cache Abstraction 사용하
여 쉽게 다른 캐시 구현체 사용 가능하
게
• ConcurrentHashMap, EHCache
• Infinispan
#2 SecurityContext를 캐시에 저장
• 기본적으로 HTTP Session에 저장
(HttpSessionSecurityContextRepository)
• SecurityContextRepository 구현한
CacheSecurityContextRepository 작성
하여 HTTP Session 대신 캐시를 사용하
도록 함
Case Study: Infinispan with Spring
Loadbalancer
Client
Client
Client
Infinispan
Application
Services
Spring
Security
WAS
Infinispan
Application
Services
Spring
Security
WAS
Infinispan
Application
Services
Spring
Security
WAS
. . .
Infinispan with Spring (cont.)
• infinispan-config.xml
<global>
<transport clusterName=”MyCacheCluster">
<properties>
<property name="configurationFile" value="jgroups-tcp.xml" />
</properties>
</transport>
</global>
<default>
<clustering mode="replication">
<sync />
</clustering>
</default>
<namedCache name="securityContextCache">
<!– maxEntries means the maximum concurrent user connections-->
<eviction strategy="LIRS" maxEntries="10000" />
<!-- the max idle time is 30 minutes -->
<expiration maxIdle="1800000" />
</namedCache>
Infinispan with Spring (cont.)
• spring-cache-config.xml
• SpringEmbeddedCacheManagerFactoryBean
<cache:annotation-driven cache-manager="myCacheManager"/>
<bean id="myCacheManager"
class="my.domain.MyCacheManagerFactoryBean"
p:configurationFileLocation="classpath:infinispan-config.xml" />
public class MyCacheManagerFactoryBean extends SpringEmbeddedCacheManagerFactoryBean {
@Override public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
addListeners();
}
private void addListeners() throws Exception {
SpringEmbeddedCacheManager cacheManager = getObject();
if (cacheManager.getNativeCacheManager() instanceof EmbeddedCacheManager) {
cacheManager.getNativeCacheManager().addListener(new MyCacheManagerListener());
}
Collection<String> cacheNames = cacheManager.getCacheNames();
for (String cacheName : cacheNames) {
SpringCache cache = cacheManager.getCache(cacheName);
if (cache.getNativeCache() instanceof Cache) {
((Cache<?,?>)cache.getNativeCache()).addListener(new MyCacheListener());
}}}}
Infinispan with Spring (cont.)
• Dao Implementation
@Named("SecurityContextDao")
public class SecurityContextDaoImpl implements SecurityContextDao {
@Cacheable(value = "securityContextCache", key="#key")
public SecurityContext getSecurityContext(String key) {
return null;
}
@CachePut(value = "securityContextCache", key="#key")
public SecurityContext setSecurityContext(String key, SecurityContext securityContext) {
return securityContext;
}
@CacheEvict(value = "securityContextCache", key="#key")
public void removeSecurityContext(String key) {
// Intentionally blank
}
}
Infinispan with Spring (cont.)
• Spring Security’s SecurityContextRepository
public class MyCacheSecurityContextRepository implements SecurityContextRepository {
@Inject SecurityContextDao securityContextDao;
public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
...
return securityContextDao.getSecurityContext(authToken);
}
public void saveContext(SecurityContext context, HttpServletRequest request,
HttpServletResponse response) {
...
securityContextDao.setSecurityContext(authToken, context);
...
}
public boolean containsContext(HttpServletRequest request) {
...
return securityContextDao.getSecurityContext(key) != null;
}
}
Infinispan with Spring (cont.)
• spring-security-config.xml
<bean id="cacheSecurityContextRepository"
class="my.domain.MyCacheSecurityContextRepository">
</bean>
<security:http pattern="/services/**" auto-config="false"
use-expressions="true" entry-point-ref="myAuthenticationEntryPoint"
authentication-manager-ref="operationsAuthenticationManager"
security-context-repository-ref="cacheSecurityContextRepository">
<security:custom-filter position="LOGOUT_FILTER" ref="myLogoutFilter" />
<security:custom-filter position="FORM_LOGIN_FILTER" ref="myAuthenticationFilter" />
<security:intercept-url pattern="/services/**" access="isFullyAuthenticated()" />
</security:http>
References
• infinispan.org
• blog.infinispan.org
• infinispan-ko.blogspot.com
• facebook.com/groups/infinispan
• red.ht/data-grid
• coherence.oracle.com
감사합니다.

More Related Content

What's hot

Project Deimos
Project DeimosProject Deimos
Project Deimos
Simon Suo
 
Giraph+Gora in ApacheCon14
Giraph+Gora in ApacheCon14Giraph+Gora in ApacheCon14
Giraph+Gora in ApacheCon14
Renato Javier Marroquín Mogrovejo
 
Impala 2.0 Update #impalajp
Impala 2.0 Update #impalajpImpala 2.0 Update #impalajp
Impala 2.0 Update #impalajp
Cloudera Japan
 
Embedded Mirror Maker
Embedded Mirror MakerEmbedded Mirror Maker
Embedded Mirror Maker
Simon Suo
 
Big data, just an introduction to Hadoop and Scripting Languages
Big data, just an introduction to Hadoop and Scripting LanguagesBig data, just an introduction to Hadoop and Scripting Languages
Big data, just an introduction to Hadoop and Scripting Languages
Corley S.r.l.
 
Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrency
Alex Miller
 
Harnessing the power of Nutch with Scala
Harnessing the power of Nutch with ScalaHarnessing the power of Nutch with Scala
Harnessing the power of Nutch with Scala
Knoldus Inc.
 
Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in Scala
Alex Payne
 
Apache Ambari: Simplified Hadoop Cluster Operation & Troubleshooting
Apache Ambari: Simplified Hadoop Cluster Operation & TroubleshootingApache Ambari: Simplified Hadoop Cluster Operation & Troubleshooting
Apache Ambari: Simplified Hadoop Cluster Operation & Troubleshooting
Jayush Luniya
 
Cassandra
CassandraCassandra
Cassandra
exsuns
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
Rahul Gupta
 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
confluent
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
Mats Kindahl
 
RubyKaigi 2014: ServerEngine
RubyKaigi 2014: ServerEngineRubyKaigi 2014: ServerEngine
RubyKaigi 2014: ServerEngine
Treasure Data, Inc.
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast Essentials
Rahul Gupta
 
Caching In The Cloud
Caching In The CloudCaching In The Cloud
Caching In The Cloud
Alex Miller
 
#GeodeSummit - Spring Data GemFire API Current and Future
#GeodeSummit - Spring Data GemFire API Current and Future#GeodeSummit - Spring Data GemFire API Current and Future
#GeodeSummit - Spring Data GemFire API Current and Future
PivotalOpenSourceHub
 
Jan 2013 HUG: Impala - Real-time Queries for Apache Hadoop
Jan 2013 HUG: Impala - Real-time Queries for Apache HadoopJan 2013 HUG: Impala - Real-time Queries for Apache Hadoop
Jan 2013 HUG: Impala - Real-time Queries for Apache Hadoop
Yahoo Developer Network
 
8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker
Fabio Fumarola
 
Overview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data ServiceOverview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data Service
SATOSHI TAGOMORI
 

What's hot (20)

Project Deimos
Project DeimosProject Deimos
Project Deimos
 
Giraph+Gora in ApacheCon14
Giraph+Gora in ApacheCon14Giraph+Gora in ApacheCon14
Giraph+Gora in ApacheCon14
 
Impala 2.0 Update #impalajp
Impala 2.0 Update #impalajpImpala 2.0 Update #impalajp
Impala 2.0 Update #impalajp
 
Embedded Mirror Maker
Embedded Mirror MakerEmbedded Mirror Maker
Embedded Mirror Maker
 
Big data, just an introduction to Hadoop and Scripting Languages
Big data, just an introduction to Hadoop and Scripting LanguagesBig data, just an introduction to Hadoop and Scripting Languages
Big data, just an introduction to Hadoop and Scripting Languages
 
Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrency
 
Harnessing the power of Nutch with Scala
Harnessing the power of Nutch with ScalaHarnessing the power of Nutch with Scala
Harnessing the power of Nutch with Scala
 
Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in Scala
 
Apache Ambari: Simplified Hadoop Cluster Operation & Troubleshooting
Apache Ambari: Simplified Hadoop Cluster Operation & TroubleshootingApache Ambari: Simplified Hadoop Cluster Operation & Troubleshooting
Apache Ambari: Simplified Hadoop Cluster Operation & Troubleshooting
 
Cassandra
CassandraCassandra
Cassandra
 
Think Distributed: The Hazelcast Way
Think Distributed: The Hazelcast WayThink Distributed: The Hazelcast Way
Think Distributed: The Hazelcast Way
 
Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19Kick your database_to_the_curb_reston_08_27_19
Kick your database_to_the_curb_reston_08_27_19
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
 
RubyKaigi 2014: ServerEngine
RubyKaigi 2014: ServerEngineRubyKaigi 2014: ServerEngine
RubyKaigi 2014: ServerEngine
 
Hazelcast Essentials
Hazelcast EssentialsHazelcast Essentials
Hazelcast Essentials
 
Caching In The Cloud
Caching In The CloudCaching In The Cloud
Caching In The Cloud
 
#GeodeSummit - Spring Data GemFire API Current and Future
#GeodeSummit - Spring Data GemFire API Current and Future#GeodeSummit - Spring Data GemFire API Current and Future
#GeodeSummit - Spring Data GemFire API Current and Future
 
Jan 2013 HUG: Impala - Real-time Queries for Apache Hadoop
Jan 2013 HUG: Impala - Real-time Queries for Apache HadoopJan 2013 HUG: Impala - Real-time Queries for Apache Hadoop
Jan 2013 HUG: Impala - Real-time Queries for Apache Hadoop
 
8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker8a. How To Setup HBase with Docker
8a. How To Setup HBase with Docker
 
Overview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data ServiceOverview of data analytics service: Treasure Data Service
Overview of data analytics service: Treasure Data Service
 

Similar to 인피니스팬데이터그리드따라잡기 (@JCO 2014)

Infinispan Data Grid Platform
Infinispan Data Grid PlatformInfinispan Data Grid Platform
Infinispan Data Grid Platform
jbugkorea
 
인피니스팬 데이터그리드 플랫폼
인피니스팬 데이터그리드 플랫폼인피니스팬 데이터그리드 플랫폼
인피니스팬 데이터그리드 플랫폼
Jaehong Cheon
 
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
VMware Tanzu
 
JCache Using JCache
JCache Using JCacheJCache Using JCache
인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처
Jaehong Cheon
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination Ext
Rohit Kelapure
 
The Design, Implementation and Open Source Way of Apache Pegasus
The Design, Implementation and Open Source Way of Apache PegasusThe Design, Implementation and Open Source Way of Apache Pegasus
The Design, Implementation and Open Source Way of Apache Pegasus
acelyc1112009
 
Hazelcast 101
Hazelcast 101Hazelcast 101
Hazelcast 101
Emrah Kocaman
 
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
James Chen
 
Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014
Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014
Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014
Chris Fregly
 
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
Claudiu Barbura
 
Deploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDeploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analytics
DataWorks Summit
 
Infinispan @ Red Hat Forum 2013
Infinispan @ Red Hat Forum 2013Infinispan @ Red Hat Forum 2013
Infinispan @ Red Hat Forum 2013
Jaehong Cheon
 
Apache Pegasus (incubating): A distributed key-value storage system
Apache Pegasus (incubating): A distributed key-value storage systemApache Pegasus (incubating): A distributed key-value storage system
Apache Pegasus (incubating): A distributed key-value storage system
acelyc1112009
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7
Rahul Gupta
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
Ondrej Mihályi
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
Payara
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
Payara
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Sunghyouk Bae
 
Hadoop User Group - Status Apache Drill
Hadoop User Group - Status Apache DrillHadoop User Group - Status Apache Drill
Hadoop User Group - Status Apache Drill
MapR Technologies
 

Similar to 인피니스팬데이터그리드따라잡기 (@JCO 2014) (20)

Infinispan Data Grid Platform
Infinispan Data Grid PlatformInfinispan Data Grid Platform
Infinispan Data Grid Platform
 
인피니스팬 데이터그리드 플랫폼
인피니스팬 데이터그리드 플랫폼인피니스팬 데이터그리드 플랫폼
인피니스팬 데이터그리드 플랫폼
 
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
Slides for the Apache Geode Hands-on Meetup and Hackathon Announcement
 
JCache Using JCache
JCache Using JCacheJCache Using JCache
JCache Using JCache
 
인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처인메모리 클러스터링 아키텍처
인메모리 클러스터링 아키텍처
 
Web Sphere Problem Determination Ext
Web Sphere Problem Determination ExtWeb Sphere Problem Determination Ext
Web Sphere Problem Determination Ext
 
The Design, Implementation and Open Source Way of Apache Pegasus
The Design, Implementation and Open Source Way of Apache PegasusThe Design, Implementation and Open Source Way of Apache Pegasus
The Design, Implementation and Open Source Way of Apache Pegasus
 
Hazelcast 101
Hazelcast 101Hazelcast 101
Hazelcast 101
 
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
 
Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014
Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014
Kinesis and Spark Streaming - Advanced AWS Meetup - August 2014
 
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, TachyonxPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
 
Deploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDeploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analytics
 
Infinispan @ Red Hat Forum 2013
Infinispan @ Red Hat Forum 2013Infinispan @ Red Hat Forum 2013
Infinispan @ Red Hat Forum 2013
 
Apache Pegasus (incubating): A distributed key-value storage system
Apache Pegasus (incubating): A distributed key-value storage systemApache Pegasus (incubating): A distributed key-value storage system
Apache Pegasus (incubating): A distributed key-value storage system
 
Distributed caching and computing v3.7
Distributed caching and computing v3.7Distributed caching and computing v3.7
Distributed caching and computing v3.7
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
 
Hadoop User Group - Status Apache Drill
Hadoop User Group - Status Apache DrillHadoop User Group - Status Apache Drill
Hadoop User Group - Status Apache Drill
 

Recently uploaded

CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
mamamaam477
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
MiscAnnoy1
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 

Recently uploaded (20)

CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 

인피니스팬데이터그리드따라잡기 (@JCO 2014)

  • 1. JBoss 인피니스팬 데이터그리드 플랫폼 따라잡기 전재홍/JBoss User Group
  • 3. Distributed Cache • Fast access to data • Performance boost • Elasticity • High Availability • JSR 107 (Temporary Caching for the Java Platform) – Read, write, expiration, write-through, distribution
  • 5. In-Memory Data Grid • Evolution of distributed caches • Clustered by nature (shared across multiple servers) • Low response time • High throughput • Predictable scalability • High Availability • Querying • Task Execution (Map/Reduce) • JSR 347 (Data Grid for the Java Platform)
  • 6. In-Memory Data Grid (cont.) Persistence (DataStore) In-Memory Data Grid Node Node Node App App App
  • 7. IMDG for What? • Sharing data (session, app states) • Toolkit for clustering • Performance (caching, in-memory processing) • Scalability • Database on cloud
  • 8. Players • Oracle Coherence • GridGain • HazelCast • IBM eXtreme Scale • GigaSpaces • VmWare GemFire • Terracotta • ScaleOut StateServer • JBoss Infinispan
  • 9. Cache vs. Data Grid • JSR 107 - Temporary Caching for the Java Platform – Basic interaction(read, write, expiry) – Transactions with JTA compatibility – Listener – Persistence: read-through, write-through, write-behind – Annotations – javax.cache.* • JSR 347 - Data Grids for the Java Platform – Asynchronous, non-blocking API – Distributed code execution and map/reduce API – Group API for co-location – Annotations (CDI) – Eventually Consistent API – Querying – Configuration – javax.datagrid.*
  • 11. Infinispan • Distributed in-memory key/value data grid and cache • Distributed as library and server • Manageable • Open Source DefaultCacheManager manager = new DefaultCacheManager(); // Cache<Integer, Ticket> cache = manager.getCache(); Cache<Integer, Ticket> cache = manager.getCache(“myCache”);
  • 12. Architecture: as library Embedded library on the same JVM with Application Infinispan JVM App
  • 13. Architecture: as library, clustered Cluster Infinispan JVM App Infinispan JVM App Infinispan JVM App Application doesn’t know it’s on cluster l Use as library – More features – Richer APIs – Programmatic/ Declarative configuration – Extendable/ embeddable – Faster (API call)
  • 14. Architecture: as server, clustered • Use as server – Remote – Data tier shared by multi-apps – App doesn’t affect cluster – Non-java clients • C++, .NET, Ruby , Python, Java Cluster Infinispan JVM Infinispan JVM Infinispan JVM App App App
  • 15. Architecture: multi clusters • Multi-clusters – By replication – By persistence – By replication to other clust er (topology a ware) Cluster Infinispan JVM Infinispan JVM Cluster Infinispan JVM Infinispan JVM persistence
  • 16. Clustering • Peer-to-Peer – No central master, no single point of failure, no single bottle neck • JGroups – Reliable multicast communication library, nodes discovery, sharing data, performing cluster scaling • Consistent Hash – Hash based data distribution – How it finds where data locates • Linear in nature: throughput, capacity
  • 17. Cluster Mode: Replication(복제) Replication Mode Cache on Server 1 K,V Cache on Server 2 K,V Cache on Server 4 K,V Cache on Server 3 K,V cache.put(K,V)
  • 18. Cluster Mode: Distribution(분산) Distribution Mode(numOwners=2) Cache on Server 1 K,V Cache on Server 2 K,V Cache on Server 4 Cache on Server 3 cache.put(K,V) cache.get(K,V)
  • 19. Cluster Mode: Invalidation(무효화) Invalidation Mode Cache on Server 1 K,V2 Cache on Server 2 K,V Cache on Server 4 Cache on Server 3 cache.put(K,V2) DB
  • 20. Persistence • Used for durability • Cache Store - Persistence Storage – File System, Cloud, Remote, JDBC, JPA, LevelDB, Cassandra, HBase, MongoDB, BerkeleyDB, JDBM, REST • CacheLoader, CacheWriter • Read-through, write-through, write-behind • Passivation, activation • Store chain • Shared store
  • 21. Persistence (cont.) • Passivation – write to persistence when evicted from memory (default) • Activation – read to memory and remove from persistence
  • 22. Transaction • JTA Transaction Support • Support MVCC (Multi-Versioned Concurrency Control) • Isolation Level – READ_COMMITTED (default) – REPEATABLE_READ • Locking Mode – Optimistic Lock (default) – Pessimistic Lock • Locking – Lock timeout – Lock striping
  • 23. Query • Query on values • JBoss Hibernate Search + Apache Lucene • Index Directory – Lucene Directory: in-memory, file system, JDBC – Infinispan Directory • Distributed queries
  • 24. Distributed Execution • Executes codes on distributed nodes • Through a standard JDK ExecutorService interface • Use DistributedCallable extends java.util.concurrent.Callable
  • 25. Map/Reduce • Based on Distributed Execution Framework • Mapper, Reducer, Collator, MapReduceTask public interface Callator<KOut, Vout, R> { R collate(Map<KOut, VOut>); } public interface Mapper<KIn, VIn, KOut, VOut> extends Serializable { void map(KIn key, VIn value, Collector<KOut, VOut> collector); } public interface Reducer<KOut, VOut> extends Serializable { VOut reduce(KOut reducedKey, Iterator<VOut> iter); }
  • 26. Configuration: Declarative • Eviction(제거) – on the memory • Expiration(만료) – on the cluster <global> <transport clusterName=“MyCacheCluster"> <properties> <property name="configurationFile" value="jgroups-tcp.xml" /> </properties> </transport> <globalJmxStatistics enabled="true" /> </global> <default> <clustering mode="replication"> <sync /> </clustering> </default> <namedCache name="secureContextCache "> <eviction strategy="LIRS" maxEntries="2000" /> <expiration lifespan="600000" /> <persistence passivation="false"> <store class="org.infinispan.persistence.file.SingleFileStore" fetchPersistentState="false" preload="true" shared="false" purgeOnStartup="true" ignoreModifications="false"> <async enabled="true" flushLockTimeout=“1000" shutdownTimeout="3000" modificationQueueSize="1500" threadPoolSize="3" /> <properties> <property name="location" value="${java.io.tmpdir}" /> </properties> </store> </persistence> </namedCache>
  • 27. Configuration: Programmatic • Configuration Based on XML • Programmatic configuration DefaultCacheManager manager = new DefaultCacheManager("infinispan-config.xml"); Configuration baseConf = manager.getDefaultCacheConfiguration(); Configuration config =new ConfigurationBuilder(). read(baseConf).expiration().lifespan(50000).build(); manager.defineConfiguration(programmaticCache, config); Cache<String, String> cache = manager.getCache("secureContextCache"); DefaultCacheManager manager = new DefaultCacheManager(); Configuration config = new ConfigurationBuilder() .loaders() .shared(false).passivation(false).preload(false) .addCacheLoader() .cacheLoader(new JdbcStringBasedCacheStore()) .addProperty("connectionFactoryClass","org.infinispan.loaders.jdbc .connectionfactory.ManagedConnectionFactory") .addProperty("datasourceJndiLocation", "java:jboss/datasources/MySQLDS") .addProperty("userName", "root") .addProperty("password", "admin") .async().threadPoolSize(10).build(); manager.defineConfiguration(programmaticCache, config); Cache<String, String> cache = manager.getCache("secureContextCache");
  • 28. Listener • Listener on CacheManager – Node join/ leave, Cache start/ stop • Cache – CRUD, Eviction/ Passivation – Rehashing/ Transaction completion @Listener public class SimpleListener { @CacheEntryCreated public void dataAdded(CacheEntryCreatedEvent event) { if (event.isPre()) { System.out.println("Before creating the entry:" + event.getKey()); } else { System.out.println("After creating the entry:" + event.getKey()); } … } DefaultCacheManager manager = new DefaultCacheManager(); manager.addListener(listener); Cache<Integer, Ticket> cache = manager.getCache(); cache.addListener(listener);
  • 29. Asynchronous APIs • put() and get() and remove() are synchronous – They wait for RPC and Locks (and maybe cache stores) • The asynchronous API returns NotifyingFuture – Events are fired on completion of the operation NotifyingFuture<String> future = c.removeAsync(key); future.attachListener(new FutureListener<String>() { @Override public void futureDone(Future<String> future) { try { future.get(); System.out.printf ("The entry stored under key %s has been removed.", key); } catch (ExecutionException e) { System.out.printf("Failed to remove %s!", key); } } });
  • 30. Spring Integration • Infinispan provider for Spring cache abstraction • infinispan-spring.jar <cache:annotation-driven cache-manager=“myCacheManager"/> <bean id="operationCacheManager" class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean" p:configurationFileLocation="classpath:infinispan -config.xml" /> @Cacheable(value = "secureContextCache", key="#contextId") public SecureLayerContext getSecureLayerContext(String contextId) { return null; } @CachePut(value = "secureContextCache", key="#contextId") public SecureLayerContext setSecureLayerContext(String contextId, SecureLayerContext secureLayerContext) { return secureLayerContext; } @CacheEvict(value = "secureContextCache", key="#contextId") public void removeSecureLayerContext(String contextId) { // Intentionally blank }
  • 31. Customizing with Interceptors • Infinispan follows Interceptor, Command/Visitor design patterns • Custom interceptor extends BaseCustomInterceptor
  • 32. Infinispan on JBoss AS 7 (WildFly 8) • Used for session clustering, Hibernate L2 cache • Application gets cache with JNDI name using @Resource • XML Configuration in server configuration file <cache-container name="web" aliases="standard-session-cache" default-cache="repl"> <transport lock-timeout="60000" /> <replicated-cache name="repl" mode="ASYNC" batching="true"> <file-store /> </replicated-cache> </cache-container>
  • 33. Marshalling • JBoss Marshalling framework used for POJOs • User can provide custom Externalizer impls for non-Serializable object • Custome marshaller can be provided as well
  • 35. Monitoring/Management • Mbeans on CacheManager, Cache • RHQ (JON, JBoss Operations Network)
  • 36. Radar Gun • Data grid and distributed cache benchmarking framework • Built to test Infinispan and other distributed data grid platforms • https://github.com/radargun/radargun
  • 38. Use Cases: In Streaming Processing Infinispan Data Grid
  • 39. Use Cases: Data Grid Platform In-Memory 대용량 데이터 처리를 위한 아키텍쳐 구조 제시 및 적용 사례, 제 6회 한국 소프트웨어 아키텍트 대회 최우수상, 2013
  • 40. Use Case: Session Clustering • Store session information into cache in Spring MVC Interceptor
  • 41. Case Study: Session Clustering #1 Spring Cache Abstraction 사용하 여 쉽게 다른 캐시 구현체 사용 가능하 게 • ConcurrentHashMap, EHCache • Infinispan #2 SecurityContext를 캐시에 저장 • 기본적으로 HTTP Session에 저장 (HttpSessionSecurityContextRepository) • SecurityContextRepository 구현한 CacheSecurityContextRepository 작성 하여 HTTP Session 대신 캐시를 사용하 도록 함
  • 42. Case Study: Infinispan with Spring Loadbalancer Client Client Client Infinispan Application Services Spring Security WAS Infinispan Application Services Spring Security WAS Infinispan Application Services Spring Security WAS . . .
  • 43. Infinispan with Spring (cont.) • infinispan-config.xml <global> <transport clusterName=”MyCacheCluster"> <properties> <property name="configurationFile" value="jgroups-tcp.xml" /> </properties> </transport> </global> <default> <clustering mode="replication"> <sync /> </clustering> </default> <namedCache name="securityContextCache"> <!– maxEntries means the maximum concurrent user connections--> <eviction strategy="LIRS" maxEntries="10000" /> <!-- the max idle time is 30 minutes --> <expiration maxIdle="1800000" /> </namedCache>
  • 44. Infinispan with Spring (cont.) • spring-cache-config.xml • SpringEmbeddedCacheManagerFactoryBean <cache:annotation-driven cache-manager="myCacheManager"/> <bean id="myCacheManager" class="my.domain.MyCacheManagerFactoryBean" p:configurationFileLocation="classpath:infinispan-config.xml" /> public class MyCacheManagerFactoryBean extends SpringEmbeddedCacheManagerFactoryBean { @Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); addListeners(); } private void addListeners() throws Exception { SpringEmbeddedCacheManager cacheManager = getObject(); if (cacheManager.getNativeCacheManager() instanceof EmbeddedCacheManager) { cacheManager.getNativeCacheManager().addListener(new MyCacheManagerListener()); } Collection<String> cacheNames = cacheManager.getCacheNames(); for (String cacheName : cacheNames) { SpringCache cache = cacheManager.getCache(cacheName); if (cache.getNativeCache() instanceof Cache) { ((Cache<?,?>)cache.getNativeCache()).addListener(new MyCacheListener()); }}}}
  • 45. Infinispan with Spring (cont.) • Dao Implementation @Named("SecurityContextDao") public class SecurityContextDaoImpl implements SecurityContextDao { @Cacheable(value = "securityContextCache", key="#key") public SecurityContext getSecurityContext(String key) { return null; } @CachePut(value = "securityContextCache", key="#key") public SecurityContext setSecurityContext(String key, SecurityContext securityContext) { return securityContext; } @CacheEvict(value = "securityContextCache", key="#key") public void removeSecurityContext(String key) { // Intentionally blank } }
  • 46. Infinispan with Spring (cont.) • Spring Security’s SecurityContextRepository public class MyCacheSecurityContextRepository implements SecurityContextRepository { @Inject SecurityContextDao securityContextDao; public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) { ... return securityContextDao.getSecurityContext(authToken); } public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) { ... securityContextDao.setSecurityContext(authToken, context); ... } public boolean containsContext(HttpServletRequest request) { ... return securityContextDao.getSecurityContext(key) != null; } }
  • 47. Infinispan with Spring (cont.) • spring-security-config.xml <bean id="cacheSecurityContextRepository" class="my.domain.MyCacheSecurityContextRepository"> </bean> <security:http pattern="/services/**" auto-config="false" use-expressions="true" entry-point-ref="myAuthenticationEntryPoint" authentication-manager-ref="operationsAuthenticationManager" security-context-repository-ref="cacheSecurityContextRepository"> <security:custom-filter position="LOGOUT_FILTER" ref="myLogoutFilter" /> <security:custom-filter position="FORM_LOGIN_FILTER" ref="myAuthenticationFilter" /> <security:intercept-url pattern="/services/**" access="isFullyAuthenticated()" /> </security:http>
  • 48. References • infinispan.org • blog.infinispan.org • infinispan-ko.blogspot.com • facebook.com/groups/infinispan • red.ht/data-grid • coherence.oracle.com