liferay + cassandra: easy integration

26
Liferay + Cassandra: Easy Integration Mauro Celani – Senior Liferay Full Stack Developer Davide Gulli – Team Leader / Senior Liferay Developer

Upload: others

Post on 05-Apr-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Liferay + Cassandra:

Easy Integration

Mauro Celani – Senior Liferay Full Stack Developer

Davide Gulli – Team Leader / Senior Liferay Developer

#LRIS17 | @davide_gulli @maucel89

Principali Caratteristiche

• NoSql

• Distribuito

• Decentralizzato

• Scalabile

#LRIS17 | @davide_gulli @maucel89

Architettura Apache Cassandra

• Cluster

• Node

#LRIS17 | @davide_gulli @maucel89

Architettura Apache Cassandra

• Cluster

• Data Center(s)

• Rack(s)

• Servers(s)

• Node(s)

#LRIS17 | @davide_gulli @maucel89

Architettura Apache Cassandra

• Node Communication

• Data Partitioning

• Data Replication

#LRIS17 | @davide_gulli @maucel89

Apache Cassandra Data Modeling

Cassandra Model RDBMS Model

Keyspace Database

Column Family Table

Primary Key Partition Key Primary Key

Clustering Key

Column Key Column Name

Column Value Column Value

Data Organization

#LRIS17 | @davide_gulli @maucel89

Apache Cassandra Data Modeling

https://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling

• Non-Goals– Minimize the Number of Writes

– Minimize Data Duplication

• Basic Goals– Spread data evenly around the cluster

– Minimize the number of partitions read

#LRIS17 | @add_twitter_handle

“Non esiste la tecnologia perfetta,

esiste quella che fa al caso tuo.”

#LRIS17 | @davide_gulli @maucel89

Quando usare Apache Cassandra

• Ho bisogno di gestire grandi moli di dati

• Ho necessità di alte performance in fase di scrittura

• Devo garantire alta affidabilità e possibilità di scaling out

#LRIS17 | @davide_gulli @maucel89

Quando non usare Apache Cassandra

• Devo gestire transazioni complesse

• Non conosco a priori le query di cui avrò bisogno

• Ho la necessità di eseguire query molto complesse

• Non ho voglia / tempo di studiare a fondo lo strumento

#LRIS17 | @davide_gulli @maucel89https://static.pexels.com

Integration Use Case

Historical Weather Data

#LRIS17 | @davide_gulli @maucel89

Historical Weather Data

Liferay DXP

#LRIS17 | @davide_gulli @maucel89

Data Model (1/3)

SELECT city, weather_element

FROM weather

WHERE city = {CITY}

AND {START_TIME} < time < {END_TIME}

#LRIS17 | @davide_gulli @maucel89

Data Model (2/3)

#LRIS17 | @davide_gulli @maucel89

Data Model (3/3)

#LRIS17 | @davide_gulli @maucel89

Osgi Modules

#LRIS17 | @davide_gulli @maucel89

Java Drivers

• Datastax (https://github.com/datastax/java-driver)

➢ Sync and Async Api

➢ Simple and Prepared statements

➢ Connection pooling

➢ Query builder

➢ Object mapper

#LRIS17 | @davide_gulli @maucel89

Dependencies (1/2)

#LRIS17 | @davide_gulli @maucel89

Dependencies (2/2)

#LRIS17 | @davide_gulli @maucel89

Archittettura (1/3)

Consumer

Service

Persistence

Model

#LRIS17 | @davide_gulli @maucel89

Archittettura (2/3)

#LRIS17 | @davide_gulli @maucel89

Archittettura (3/3)

#LRIS17 | @davide_gulli @maucel89

DEMO TIME

Liferay DXP

#LRIS17 | @davide_gulli @maucel89

Mauro Celani

Senior Liferay

Full Stack Developer,

SMC

Davide Gulli

Team Leader

Senior Liferay Developer,

SMC

Thank You

#LRIS17 | @davide_gulli @maucel89

#LRIS17 | @davide_gulli @maucel89

Credits

• Planet Earth and Antenna Icon made by Freepik from www.flaticon.com