Spring Data (GemFire) Overview

43

Transcript of Spring Data (GemFire) Overview

Page 1: Spring Data (GemFire) Overview
Page 2: Spring Data (GemFire) Overview

2© 2014 Pivotal Software, Inc. All rights reserved.

Presenter

John Blum @john_blum jxblumSenior Software EngineerSpring Data TeamPivotal Software, Inc.

Roles✧ Spring Data Team

✧ Spring Data GemFire Lead✧ Spring Data Cassandra Lead

✧ Apache Geode Committer

✧ Previously Pivotal GemFire Engineer & Technical Lead

Page 3: Spring Data (GemFire) Overview

3© 2014 Pivotal Software, Inc. All rights reserved. 3© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFirePast, Present & Future

John BlumSpring Data Team

Page 4: Spring Data (GemFire) Overview

4© 2014 Pivotal Software, Inc. All rights reserved.

Agenda✧ Background

✧ Project-Release Management

✧ Project Intent

✧ Recommended Practices (Tips)

✧ Improvements

✧ What’s next?

✧ QA

Page 5: Spring Data (GemFire) Overview

5© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data Team✧ John Blum

✧ Spring Data GemFire✧ Spring Data Cassandra

✧ Mark Paluch✧ Spring Data Redis✧ Spring Data Cassandra

✧ Christoph Strobl✧ Spring Data Redis✧ Spring Data MongoDB

✧ Greg Turnquist✧ Spring Data REST

✧ Oliver Gierke✧ Spring Data Team Lead

SpringData

✧ Spring Data Commons✧ Spring Data JPA✧ Spring Data MongoDB✧ Spring Data Redis✧ Spring Data Solr✧ Spring Data GemFire✧ Spring Data KeyValue✧ Spring Data REST✧ Spring Data Cassandra

http://projects.spring.io/spring-data/

Page 6: Spring Data (GemFire) Overview

6© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire Leadership✧ Costin Leau – Spring Team

✧ June 2010 – July 2012

✧ David Turanski – Spring Data/XD Teams

✧ August 2012 – August 2013

✧ John Blum – Spring Data Team

✧ August 2013 – Present SpringData

Page 7: Spring Data (GemFire) Overview

7© 2014 Pivotal Software, Inc. All rights reserved.

July 2013

July 2014

July 2015

July 2016

2012 - 2013SDG 1.2 – 1.3.2

GemFire 7.0David Turanski

2010-06-29Initial CommitGemFire 6.0.1Costin Leau

2013-08SDG 1.3.x

GemFire 7.0.1John Blum

2013-11-12SDG 1.3.3

GemFire 7.0.1

2014-04-03SDG 1.3.4

GemFire 7.0.1

2014-05-20SDG 1.4 GA

Dijkstra (1.4.6)GemFire 7.0.2

2014-09-05SDG 1.5 GA Evans (1.5.4)GemFire 7.0.2

2015-03-23SDG 1.6 GA

Fowler (1.6.3)GemFire 8.0.0

2015-09-01SDG 1.7 GA

Gosling (1.7.4)GemFire 8.1.0

2016-04-06SDG 1.8 GA

Hopper (1.8.2)GemFire 8.2.0

2016-07 ?SDG 1.9 M1

IngallsGemFire 8.2.1

2015-06-12SDG 1.7

(1.7.0.APACHE-GEODE-EA-SNAPSHOT)Apache Geode

1.0.0-incubating.SNAPSHOT

2016-02-10SDG 1.7

(1.7.0.APACHE-GEODE-EA-M1)Apache Geode

1.0.0-incubating-M1

2016-04-28Spring Data Geode 1.0.0

(1.0.0.APACHE-GEODE-INCUBATING-M2)Apache Geode

1.0.0-incubating.M2

2016-07 ?Spring Data Geode 1.0.0(1.0.0.APACHE-GEODE-

INCUBATING-M3)Apache Geode

1.0.0-incubating.M3

Page 8: Spring Data (GemFire) Overview

8© 2014 Pivotal Software, Inc. All rights reserved.

2013

2014

2015

2016

2017

2015

2016

2017

2015-09-01SDG 1.7 GA

Gosling (1.7.4)GemFire 8.1.0

2016-04-06SDG 1.8 GA

Hopper (1.8.2)GemFire 8.2.0

2016-12 ?SDG 1.9 GA

IngallsGemFire 8.2.1 …

2015-06-12SDG 1.7.0.APACHE-GEODE-EA-SNAPSHOTApache Geode 1.0.0-incubating.SNAPSHOT

2016-02-10SDG 1.7.0.APACHE-GEODE-EA-M1

Apache Geode 1.0.0-incubating-M1

2016-04-28Spring Data Geode 1.0.0.APACHE-GEODE-INCUBATING-M2

Apache Geode 1.0.0-incubating.M2

2016-07 ?Spring Data Geode 1.0.0(1.0.0.APACHE-GEODE-

INCUBATING-M3)Apache Geode

1.0.0-incubating.M3

SDG forks April 27, 2015SGF-398 – Support for Apache Geode

apache-geode GitHub branch

SDG with Apache Geode supportReleased June 12th, 2015

Announcement on spring.io/blog

SDG for Apache Geode name/version changeSpring Data Geode/1.0.0

Announcement on spring.io/blogArtifact in Maven Central

Spring Data GemFire

Spring Data Geode

Page 9: Spring Data (GemFire) Overview

9© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire / Geode Maven Artifacts

Spring Data GemFire<dependency> <groupId>org.springframework.data </groupId> <artifactId>spring-data-gemfire</artifactId> <version>1.8.2.RELEASE</version></dependency>

Spring Data Geode<dependency> <groupId>org.springframework.data </groupId> <artifactId>spring-data-geode</artifactId> <version>1.0.0.APACHE-GEODE-INCUBATING-M2</version></dependency>

Pivotal GemFire

http://search.maven.org/#artifactdetails%7Corg.springframework.data%7Cspring-data-gemfire%7C1.8.2.RELEASE%7Cjar

http://search.maven.org/#artifactdetails%7Corg.springframework.data%7Cspring-data-geode%7C1.0.0.APACHE-GEODE-INCUBATING-M2%7Cjar

Page 11: Spring Data (GemFire) Overview

11© 2014 Pivotal Software, Inc. All rights reserved.

Release TimelineSpring Data Geode

✧ Spring Data Geode is not part of the Spring Data Release Train.

✧ Spring Data Geode releases correspond to Apache Geode releases.✧ Release Management Wiki Page

Page 12: Spring Data (GemFire) Overview

12© 2014 Pivotal Software, Inc. All rights reserved.

Version SupportSpring Data GemFire

SDG Version Latest Version Spring Framework Spring Boot GemFire

1.3.x 1.3.4.RELEASE 3.0.x -- 7.0.1

1.4.x (Dijkstra)

1.4.6.RELASE 3.1.x 1.1.x 7.0.2

1.5.x (Evans)

1.5.4.RELEASE 3.2.x (3.2.17.RELEASE)

1.2.x (1.2.8.RELEASE)

7.0.2

1.6.x (Fowler)

1.6.3.RELEASE 4.0.x -- 8.0.0

1.7.x (Gosling)

1.7.4.RELEASE 4.1.x 1.3.x (1.3.6.RELEASE)

8.1.0

1.8.x (Hopper)

1.8.2.RELEASE 4.2.x (4.2.7.RELEASE)

1.4.0.RC1 8.2.0

1.9.x (Ingalls)

1.9.0.BUILD-SNAPSHOT 4.2.x (4.2.7.RELEASE)

-- 8.2.1

https://github.com/spring-projects/spring-data-gemfire/wiki/Spring-Data-GemFire-to-GemFire-Version-Compatibility

Page 13: Spring Data (GemFire) Overview

13© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data SupportSpring Boot

1.2(1.2.8.RELEASE)

1.3(1.3.6.RELEASE)

1.4(1.4.0.RC1)

Spring Data EvansSDG 1.5.4.RELEASE

Spring Data GoslingSDG 1.7.4.RELEASE

Spring Data HopperSDG 1.8.2.RELEASE

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-gemfire</artifactId> <version>1.4.0.RC1</version></dependency>`

Page 14: Spring Data (GemFire) Overview

14© 2014 Pivotal Software, Inc. All rights reserved.

“Simple things should be simple; complex things should be possible”

– Alan Kay

Page 15: Spring Data (GemFire) Overview

15© 2014 Pivotal Software, Inc. All rights reserved.

Intent & PurposeSpring Data GemFire / Geode

1. Focus on integrating the core Spring Framework’s powerful, non-invasive programming model & concepts to simplify the configuration and development of highly-scalable, distributed Spring applications using either Pivotal GemFire or Apache Geode.

2. Integration with the Spring portfolio…

Page 16: Spring Data (GemFire) Overview

16© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire / Geode Spring Framework

+ +

Using Pivotal GemFire or Apache Geode With Spring’s Transaction Management and Spring Data GemFire/Geode

To support both Local & Global (JTA) Transactions

|

Page 18: Spring Data (GemFire) Overview

18© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire / Geode Spring Data Commons

+

Using Pivotal GemFire or Apache Geode With SD Commons Repository Infrastructure and SD GemFire/Geode To rapidly build Data Access Objects (CRUD + Mapping + Querying)

|

Page 19: Spring Data (GemFire) Overview

19© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire / Geode Spring Data REST + Spring HATEAOS

+

Using Pivotal GemFire or Apache Geode With SDC Repositories, Spring Data REST and Spring HATEAOSTo easily create mature, hypermedia-driven REST web services

| +

Page 21: Spring Data (GemFire) Overview

21© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire Spring Session

+

Using Pivotal GemFire with Spring Session (Data GemFire)To simplify (HTTP) Session State Management

+

Page 22: Spring Data (GemFire) Overview

22© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire Spring XD

+

Using Pivotal GemFire with Spring XD (CQ, source & sink) To simplify Big Data applications

Performing Ingest, Analytics, Batch Jobs and Data Export

Page 23: Spring Data (GemFire) Overview

23© 2014 Pivotal Software, Inc. All rights reserved.

Spring Data GemFire Spring Boot

+

Using Pivotal GemFire with Spring BootTo get up and running as quickly as possible

+

Page 24: Spring Data (GemFire) Overview

24© 2014 Pivotal Software, Inc. All rights reserved.

Pivotal GemFire & Spring Cloud

+

Use Spring Cloud (Connectors)To build Cloud Native Applications and Microservices

Using Pivotal GemFire

Page 25: Spring Data (GemFire) Overview

25© 2014 Pivotal Software, Inc. All rights reserved.

RecommendationsSpring Data GemFire

• Use Spring Boot

• Do not mix Spring (Java/XML) config with cache.xml or GemFire’s Cluster Config

• Prefer Java-based container configuration over XML

• Prefer the GemFireTemplate, Cache Abstraction and Repositories over direct use of GemFire’s API

• Do not use GemFire’s JTA Transaction Manager implementation; use Atomikos or another (OSS) JTA provider

• Know the difference between client/server and embedded peer cache Spring applications

Page 26: Spring Data (GemFire) Overview

26© 2014 Pivotal Software, Inc. All rights reserved.

Recommendations continued…Spring Data GemFire

• Learn GemFire forward (doc) and backwards (wiki), inside (source) and out (API)

• Make sure you really understand Spring’s core concepts and the programming model– DI, AOP, Templates, Data Access, Integration, MVC, Testing, etc…

Page 27: Spring Data (GemFire) Overview

27© 2014 Pivotal Software, Inc. All rights reserved.

Repository Query (Method) Extensions via Annotations (1.7)Improvement

interface CustomerRepository extends GemfireRepository<Customer, Long> {

@Trace @Limit(25) @Import(“org.example.app.domain.Customer”) @Hint({ “CustomerIdIdx”, “CustomerLastNameIdx” }) List<Customer> findByLastName(String lastName);

}

http://docs.spring.io/spring-data-gemfire/docs/current/reference/html/#gemfire-repositories.oql-extension

SGF-392 – Add support for OQL Query statement extensions in Repository Query methods via Annotations

Page 28: Spring Data (GemFire) Overview

28© 2014 Pivotal Software, Inc. All rights reserved.

Custom Expiration Annotation Support (1.7)Improvement

@TimeToLiveExpiration(timeout=“@expirationSettings[‘spel-defined-timeout’]” , action=“DESTROY”)@IdleTimeout(timeout=“300”, action=“${property.placeholder.defined.action}” )@Region(“Example”)class ApplicationDomainObject { .. }

http://docs.spring.io/spring-data-gemfire/docs/current/reference/html/#bootstrap:region:expiration:annotation

SGF-404 – Enable Expiration settings and policies to be specified per application domain object using…

Page 29: Spring Data (GemFire) Overview

29© 2014 Pivotal Software, Inc. All rights reserved.

Custom Expiration Annotation Support (Java config)Improvement

@Bean(name = “Example”)public PartitionedRegionFactoryBean exampleRegion(GemFireCache gemfireCache @Qualifier(“exampleRegionAttributes”) RegionAttributes<?,?> exampleRegionAttributes) {

PartitionedRegionFactoryBean exampleRegion = new PartitionedRegionFactoryBean();

exampleRegion.setCache(gemfireCache); exampleRegion.setAttributes(exampleRegionAttributes);

return exampleRegion;}

@Beanpublic RegionAttributesFactoryBean exampleRegionAttributes() { RegionAttributesFactoryBean exampleRegionAttributes = new RegionAttributesFactoryBean();

exampleRegionAttributes.setCustomEntryIdleTimeout(AnnotationBasedExpiration.forIdleTimeout());

return exampleRegionAttributes;}

Page 30: Spring Data (GemFire) Overview

30© 2014 Pivotal Software, Inc. All rights reserved.

Custom Expiration Annotation Support (XML)Improvement

<bean id="ttlExpiration" class="org.springframework.data.gemfire.support.AnnotationBasedExpiration" factory-method="forTimeToLive"/>

<gfe:partitioned-region id="Example" persistent="false"> <gfe:custom-entry-ttl ref="ttlExpiration"/></gfe:partitioned-region>

Page 31: Spring Data (GemFire) Overview

31© 2014 Pivotal Software, Inc. All rights reserved.

Data Snapshot Import/Export Support (1.7)Improvement

<gfe:partitioned-region id=“Users” persistent=“true” … /><gfe:partitioned-region id=“GuestUsers” persistent=“false” … />

<gfe-data:snapshot-service id=“cacheSnapshotService”> <gfe-data:snapshot-import location=“/path/to/users.zip”/> <gfe-data:snapshot-export location=“/path/to/snapshot/directory”/></gfe-data:snapshot-service/>

<gfe-data:snapshot-service id=“guestUsersSnapshotService” region-ref=“GuestUsers”> <gfe-data:snapshot-import location=“/path/to/users.snapshot”> <bean class=“example.GuestUsersSnapshotFilter”/> </gfe-data:snapshot-import> <gfe-data:snapshot-export location=“/path/to/activeUsers.snapshot” filter-ref=“activeUsersFilter”/></gfe-data:snapshot-service>

http://docs.spring.io/spring-data-gemfire/docs/current/reference/html/#bootstrap:snapshot

SGF-408 – Provide support in the SDG XML namespace to load pre-defined data set…

Page 33: Spring Data (GemFire) Overview

33© 2014 Pivotal Software, Inc. All rights reserved.

Improve Java-based Configuration SupportNext

@ClientCacheApplication(..)class ExampleClientCacheApplication {

}

@PeerCacheApplication(..)class ExamplePeerCacheApplication {

}

@CacheServerApplication(..)class ExampleCacheServerApplication {

}

SGF-492 – Improve GemFire Java-based configuration support

Page 34: Spring Data (GemFire) Overview

34© 2014 Pivotal Software, Inc. All rights reserved.

Annotation Support for GemFire Callbacks, CQs, IndexesNext

@Componentpublic class ExampleApplicationCallbacks {

@CacheListener(region = “Example”) public void afterCreate(EntryEvent<K, V> entryEvent) { .. }

@CacheListener(region = “AnotherExample”) public void afterUpdate(EntryEvent<K, V> entryEvent) { .. }}

SGF-453 – Add annotation support for GemFire callbacks

SGF-110 – Add annotation support for CQ Listeners

SGF-106 – Add annotation support for creating Indexes

Page 35: Spring Data (GemFire) Overview

35© 2014 Pivotal Software, Inc. All rights reserved.

Other Notables…Next

• SGF-301 – Refactor SDG Examples to use Spring Boot– Move to Spring Data Examples project

• SGF-377 – Implement Reactive Streams API for GemFire’s CQs

• SGF-451 – Support Function context aware Repositories

• SGF-452 – Support Function Executions on Repositories

• Follow the link for a complete list of all open Spring Data GemFire JIRA tickets.

• Design/Development on spring-data-gemfire-extensions.

• But wait, there is more…

Page 36: Spring Data (GemFire) Overview

36© 2014 Pivotal Software, Inc. All rights reserved.

PR #6224 – Auto-configuration support for SDG RepositoriesSpring Boot

interface CustomerRepository extends Repository<Customer, Long> {}

@Region(“Customers”)class Customer {}

compile “org.springframework.boot:spring-boot-starter-data-gemfire:1.4.0.RC1”

@SpringBootApplication@EnableGemfireRepositoriesclass ExampleSpringBootApplication {}

No longer necessary…

Page 37: Spring Data (GemFire) Overview

37© 2014 Pivotal Software, Inc. All rights reserved.

PR #5445 – Spring Boot Starter Data GeodeSpring Boot

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-geode</artifactId> <version>???</version></dependency>`

Page 38: Spring Data (GemFire) Overview

38© 2014 Pivotal Software, Inc. All rights reserved.

PR #366 – Spring Session Data GeodeSpring Session

<dependency> <groupId>org.springframework.session</groupId> <artifactId>spring-session-data-geode</artifactId> <version>???</version></dependency>`

Page 40: Spring Data (GemFire) Overview

40© 2014 Pivotal Software, Inc. All rights reserved.

Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Spring Data and In-Memory Data Management in Action

August 1 – 4, 2016, Aria, Las Vegas, NV

By John Blum, Luke Shannon@john_blum, @lukewshannon

Page 41: Spring Data (GemFire) Overview

41© 2014 Pivotal Software, Inc. All rights reserved. 41© 2014 Pivotal Software, Inc. All rights reserved.

QuestionsAnswers

Page 42: Spring Data (GemFire) Overview

42© 2014 Pivotal Software, Inc. All rights reserved. 42© 2014 Pivotal Software, Inc. All rights reserved.

Thank you

Page 43: Spring Data (GemFire) Overview