SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
Sergio Bossa                        @sbtourist


               Terrastore
          A document database for
                developers
About Me
Software architect and engineer
   Gioco Digitale (online gambling and casinos).

Long time open source enthusiast and contributor
  Spring.
  Taconite.
  Terracotta.
  Actorom, Terrastore ...

(Micro)-Blogger
   http://twitter.com/sbtourist
   http://sbtourist.blogspot.com
NOSQL ... what?
1998
   Just a tiny non-relational database.
2009
   Non-relational databases as a replacement for
   relational ones?
Nowadays ...
   Not Only SQL.
       Use the right tool for your job.
NOSQL ... why?
          When you're in troubles with ...

Data Model.
   Relational mismatch.
   Variable schema.
Data Access Patterns.
   Expensive joins.
   Denormalized data.
Scalability.
   More data.
   More processing.
No SQL, Yes ... ?
Heterogeneity.
   Key/Value based.
      Voldemort.
   Document based.
      MongoDB.
      Riak.
      Terrastore.
   Column based.
      Cassandra.
      HBase.
   Graph based.
      Neo4J.
Terrastore!
Document Store.
   Ubiquitous.
   Consistent.
   Distributed.
   Scalable.
Written in Java.
Based on Terracotta.
Open Source.
Apache-licensed.
Your data, your documents
     {
         "name" : "Sergio",
         "surname" : "Bossa",
         "twitter" : "@sbtourist"
     }
Access everywhere
Keep consistent
Distribute as a single cluster
Distribute as multiple clusters
But ... Why Terrastore?!?!
Make ...
Simple things easy
Complex things
   possible
  ( almost ;)
Get started in seconds
   One command installation and startup ...

$> ant -f terrastore-install.xml 
quickstart -Dquickstart.dir=...
Easy installation
   Master:

$> ant -f terrastore-install.xml 
single-master 
-Dmaster.server.port 9510 
-Dinstall.dir=...


   Server:

$> ant -f terrastore-install.xml 
server 
-Dinstall.dir=...
No complex configuration
    Master:
$master>./start.sh


    Server:
$server>./start.sh 
--master 
--httpHost 
--httpPort 
--nodeHost 
--nodePort 
...
No impedence mismatch
   Java:
public class Character {
  private String name;
  private List<Character> friends;
  private List<Character> foes;
  // ...
}


   Json:
{"name" : "Spider-man",
"friends" : [{"name" : "Iceman"}]
"foes" : [{"name" : "Kingpin"}]}
Simple basic operations
    Put documents in buckets ...

PUT /bucket/key
Content-Type: application/json
{...}

    Get documents from buckets ...

GET /bucket/key
Content-Type: application/json
{...}
Range queries
      Find documents in bucket with keys in a given range
      ...
GET /bucket/range?comparator=comparator_name&
startKey=start_key&
endKey=end_key&
timeToLive=max_age
Content-Type: application/json
{...}
Built-in comparators
Lexicographical
   Ascendant.
   Descendant.
Numerical.
   Ascendant.
   Descendant.
What if ... custom comparators?
@AutoDetect(name="my-comparator")
public class MyComparator implements
  terrastore.store.operators.Comparator {

    public int compare(String key1, String key2) {
      // ...
    }
}
Predicate queries
    Find documents in bucket satisfying a given predicate
    condition ...
GET /bucket/predicate?
predicate=type:expression
Content-Type: application/json
{...}
Conditional put/get
    Conditionally put documents in buckets ...

PUT /bucket/key?
predicate=type:expression
Content-Type: application/json
{...}

    Conditionally get documents from buckets ...

GET /bucket/key?
predicate=type:expression
Content-Type: application/json
{...}
Built-in predicate conditions
JXPapth
   Based on X-Path.
   Find people whose name is 'Sergio':
      jxpath:/name[.='Sergio']
JavaScript
   Applies a JavaScript-like condition.
   Find people whose name is 'Sergio':
      js:value.name=='Sergio'
What if ... custom conditions?
@AutoDetect(name="my-condition")
public class MyCondition implements
  terrastore.store.operators.Condition {

    public boolean isSatisfied(String key,
       Map<String, Object> value, String expression) {
      // ...
    }
}
Server-side updates
   Atomically execute complex updates to a document ...

PUT /bucket/key/update?function=function_name&
timeout=timeout_value
Content-Type: application/json
{...}
Built-in update functions
Atomic Counters
   Atomically increment/decrement/set-up one or
   more counters.
Merge
   Merge the stored document with provided values.
JavaScript custom update
   Update the stored document by executing a user-
   provided javascript function.
What if ... custom functions?
@AutoDetect(name="my-function")
public class MyFunction implements
  terrastore.store.operators.Function {

    public Map<String, Object> apply(String key,
      Map<String, Object> value,
      Map<String, Object> parameters) {
      // ...
    }
}
Easy scale-out
    A command line parameter:

$server>./start.sh 
--master 
--ensemble

    And a json configuration file:

{
"localCluster" : "apple",
"discoveryInterval" : 5000,
"clusters" : ["apple", "orange"],
"seeds" : {"orange" : "192.168.1.2:6001"}
}
DSL-like Java APIs
     Fluent APIs.
     Http-based.
     Transparent (yet configurable) object conversion.
// Create client:
TerrastoreClient client =
new TerrastoreClient("http://localhost:8080",
new HTTPConnectionFactory());

// Create object:
Person sbtourist = new Person("Sergio Bossa”, "sbtourist")

// Put:
client.bucket("people").key("1").put(person);

// Get:
sbtourist = client.bucket("people").key("1").get(Person.class);
Support for other languages
Clojure
   http://github.com/sbtourist/terrastore-cloj
Python
   http://dnene.bitbucket.org/docs/pyterrastore
Scala
   http://github.com/ssuravarapu/Terrastore-Scala-Client
   http://github.com/teigen/terrastore-scala
Easy to add more!
Pure Javascript Web Console
More!
Backup
   Import/export documents to/from buckets.
Events management
   Get notified of document updates.
       Third-party products integration.
       Write-behind.
   ActiveMQ integration for higher reliability.
Custom data partitioning
   Retain control of where your data is placed.
Indexing and searching
   Terrastore-Search.
       ElasticSearch integration.
Cross-origin resource sharing support
   Integrate with browser-based clients.
Now that I have an hammer ...
 Don't go blinded.
   Use the right tool for the job!

 Terrastore is best suited for:
    Data hot spots.
    Computational data.
    Complex, rich or variable data.
    Throw-away data.
Final words ... engaging.
Explore
   http://code.google.com/p/terrastore
Download
   http://code.google.com/p/terrastore/downloads/list
Hack
   http://code.google.
   com/p/terrastore/source/checkout
Participate
   http://groups.google.com/group/terrastore-
   discussions
Enjoy!
Q&A  Contact me on:
http://twitter.com/sbtourist

Más contenido relacionado

La actualidad más candente

Bastion Host : Amazon Web Services
Bastion Host : Amazon Web ServicesBastion Host : Amazon Web Services
Bastion Host : Amazon Web ServicesAkhilesh Joshi
 
성능 최대화를 위한 CloudFront 설정 Best Practice
성능 최대화를 위한 CloudFront 설정 Best Practice성능 최대화를 위한 CloudFront 설정 Best Practice
성능 최대화를 위한 CloudFront 설정 Best PracticeGS Neotek
 
OSMC 2021 | Introduction into OpenSearch
OSMC 2021 | Introduction into OpenSearchOSMC 2021 | Introduction into OpenSearch
OSMC 2021 | Introduction into OpenSearchNETWAYS
 
Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...
Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...
Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...Simplilearn
 
OpenNMS - My Notes
OpenNMS - My NotesOpenNMS - My Notes
OpenNMS - My Notesashrawi92
 
Hadoop HDFS Architeture and Design
Hadoop HDFS Architeture and DesignHadoop HDFS Architeture and Design
Hadoop HDFS Architeture and Designsudhakara st
 
BDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
BDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMRBDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
BDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMRAmazon Web Services
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링OpenStack Korea Community
 
MikroTik RouterOS Security Automation With Ansible
MikroTik RouterOS Security Automation With AnsibleMikroTik RouterOS Security Automation With Ansible
MikroTik RouterOS Security Automation With AnsibleI Putu Hariyadi
 
Demystifying OpenStack for NFV
Demystifying OpenStack for NFVDemystifying OpenStack for NFV
Demystifying OpenStack for NFVTrinath Somanchi
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsLilia Sfaxi
 
Taller Redis
Taller RedisTaller Redis
Taller Redisbetabeers
 
NVMe over Fabrics Demystified
NVMe over Fabrics Demystified NVMe over Fabrics Demystified
NVMe over Fabrics Demystified Brad Eckert
 
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법Open Source Consulting
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험NHN FORWARD
 
Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...
Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...
Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...Amazon Web Services
 
OpenStack Architecture and Use Cases
OpenStack Architecture and Use CasesOpenStack Architecture and Use Cases
OpenStack Architecture and Use CasesJalal Mostafa
 
Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...
Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...
Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...Edureka!
 

La actualidad más candente (20)

Bastion Host : Amazon Web Services
Bastion Host : Amazon Web ServicesBastion Host : Amazon Web Services
Bastion Host : Amazon Web Services
 
성능 최대화를 위한 CloudFront 설정 Best Practice
성능 최대화를 위한 CloudFront 설정 Best Practice성능 최대화를 위한 CloudFront 설정 Best Practice
성능 최대화를 위한 CloudFront 설정 Best Practice
 
OSMC 2021 | Introduction into OpenSearch
OSMC 2021 | Introduction into OpenSearchOSMC 2021 | Introduction into OpenSearch
OSMC 2021 | Introduction into OpenSearch
 
Hadoop Interview Questions and Answers
Hadoop Interview Questions and AnswersHadoop Interview Questions and Answers
Hadoop Interview Questions and Answers
 
Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...
Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...
Hadoop Training | Hadoop Training For Beginners | Hadoop Architecture | Hadoo...
 
OpenNMS - My Notes
OpenNMS - My NotesOpenNMS - My Notes
OpenNMS - My Notes
 
Hadoop HDFS Architeture and Design
Hadoop HDFS Architeture and DesignHadoop HDFS Architeture and Design
Hadoop HDFS Architeture and Design
 
BDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
BDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMRBDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
BDA302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
 
Pulsar Handson 20180226
Pulsar Handson 20180226Pulsar Handson 20180226
Pulsar Handson 20180226
 
MikroTik RouterOS Security Automation With Ansible
MikroTik RouterOS Security Automation With AnsibleMikroTik RouterOS Security Automation With Ansible
MikroTik RouterOS Security Automation With Ansible
 
Demystifying OpenStack for NFV
Demystifying OpenStack for NFVDemystifying OpenStack for NFV
Demystifying OpenStack for NFV
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Taller Redis
Taller RedisTaller Redis
Taller Redis
 
NVMe over Fabrics Demystified
NVMe over Fabrics Demystified NVMe over Fabrics Demystified
NVMe over Fabrics Demystified
 
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...
Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...
Deep Dive on Amazon Aurora with PostgreSQL Compatibility (DAT305-R1) - AWS re...
 
OpenStack Architecture and Use Cases
OpenStack Architecture and Use CasesOpenStack Architecture and Use Cases
OpenStack Architecture and Use Cases
 
Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...
Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...
Spark SQL Tutorial | Spark Tutorial for Beginners | Apache Spark Training | E...
 

Similar a Terrastore - A document database for developers

The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...SPTechCon
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQLLuca Garulli
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsMykyta Protsenko
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring DataEric Bottard
 
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlibElasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlibJen Aman
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Prajal Kulkarni
 
Hammock, a Good Place to Rest
Hammock, a Good Place to RestHammock, a Good Place to Rest
Hammock, a Good Place to RestStratoscale
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstackRoberto Polli
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceSven Ruppert
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Kerberizing spark. Spark Summit east
Kerberizing spark. Spark Summit eastKerberizing spark. Spark Summit east
Kerberizing spark. Spark Summit eastJorge Lopez-Malla
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Zabbix
 

Similar a Terrastore - A document database for developers (20)

The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and Ops
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring Data
 
Guillotina
GuillotinaGuillotina
Guillotina
 
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlibElasticsearch And Apache Lucene For Apache Spark And MLlib
Elasticsearch And Apache Lucene For Apache Spark And MLlib
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 
Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.Null Bachaav - May 07 Attack Monitoring workshop.
Null Bachaav - May 07 Attack Monitoring workshop.
 
Hammock, a Good Place to Rest
Hammock, a Good Place to RestHammock, a Good Place to Rest
Hammock, a Good Place to Rest
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
Play framework
Play frameworkPlay framework
Play framework
 
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Kerberizing spark. Spark Summit east
Kerberizing spark. Spark Summit eastKerberizing spark. Spark Summit east
Kerberizing spark. Spark Summit east
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
 

Más de Sergio Bossa

To be relational, or not to be relational? That's NOT the question!
To be relational, or not to be relational? That's NOT the question!To be relational, or not to be relational? That's NOT the question!
To be relational, or not to be relational? That's NOT the question!Sergio Bossa
 
Three Languages in Thirty Minutes
Three Languages in Thirty MinutesThree Languages in Thirty Minutes
Three Languages in Thirty MinutesSergio Bossa
 
Actor concurrency for the JVM: a case study
Actor concurrency for the JVM: a case studyActor concurrency for the JVM: a case study
Actor concurrency for the JVM: a case studySergio Bossa
 
Scalable Databases - From Relational Databases To Polyglot Persistence
Scalable Databases - From Relational Databases To Polyglot PersistenceScalable Databases - From Relational Databases To Polyglot Persistence
Scalable Databases - From Relational Databases To Polyglot PersistenceSergio Bossa
 
Scale Your Database And Be Happy
Scale Your Database And Be HappyScale Your Database And Be Happy
Scale Your Database And Be HappySergio Bossa
 
Clustering In The Wild
Clustering In The WildClustering In The Wild
Clustering In The WildSergio Bossa
 
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Sergio Bossa
 

Más de Sergio Bossa (8)

To be relational, or not to be relational? That's NOT the question!
To be relational, or not to be relational? That's NOT the question!To be relational, or not to be relational? That's NOT the question!
To be relational, or not to be relational? That's NOT the question!
 
Three Languages in Thirty Minutes
Three Languages in Thirty MinutesThree Languages in Thirty Minutes
Three Languages in Thirty Minutes
 
Actor concurrency for the JVM: a case study
Actor concurrency for the JVM: a case studyActor concurrency for the JVM: a case study
Actor concurrency for the JVM: a case study
 
Scalable Databases - From Relational Databases To Polyglot Persistence
Scalable Databases - From Relational Databases To Polyglot PersistenceScalable Databases - From Relational Databases To Polyglot Persistence
Scalable Databases - From Relational Databases To Polyglot Persistence
 
Scale Your Database And Be Happy
Scale Your Database And Be HappyScale Your Database And Be Happy
Scale Your Database And Be Happy
 
Clustering In The Wild
Clustering In The WildClustering In The Wild
Clustering In The Wild
 
Real Terracotta
Real TerracottaReal Terracotta
Real Terracotta
 
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
Gridify your Spring application with Grid Gain @ Spring Italian Meeting 2008
 

Terrastore - A document database for developers

  • 1. Sergio Bossa @sbtourist Terrastore A document database for developers
  • 2. About Me Software architect and engineer Gioco Digitale (online gambling and casinos). Long time open source enthusiast and contributor Spring. Taconite. Terracotta. Actorom, Terrastore ... (Micro)-Blogger http://twitter.com/sbtourist http://sbtourist.blogspot.com
  • 3. NOSQL ... what? 1998 Just a tiny non-relational database. 2009 Non-relational databases as a replacement for relational ones? Nowadays ... Not Only SQL. Use the right tool for your job.
  • 4. NOSQL ... why? When you're in troubles with ... Data Model. Relational mismatch. Variable schema. Data Access Patterns. Expensive joins. Denormalized data. Scalability. More data. More processing.
  • 5. No SQL, Yes ... ? Heterogeneity. Key/Value based. Voldemort. Document based. MongoDB. Riak. Terrastore. Column based. Cassandra. HBase. Graph based. Neo4J.
  • 6. Terrastore! Document Store. Ubiquitous. Consistent. Distributed. Scalable. Written in Java. Based on Terracotta. Open Source. Apache-licensed.
  • 7. Your data, your documents { "name" : "Sergio", "surname" : "Bossa", "twitter" : "@sbtourist" }
  • 10. Distribute as a single cluster
  • 12. But ... Why Terrastore?!?!
  • 15. Complex things possible ( almost ;)
  • 16. Get started in seconds One command installation and startup ... $> ant -f terrastore-install.xml quickstart -Dquickstart.dir=...
  • 17. Easy installation Master: $> ant -f terrastore-install.xml single-master -Dmaster.server.port 9510 -Dinstall.dir=... Server: $> ant -f terrastore-install.xml server -Dinstall.dir=...
  • 18. No complex configuration Master: $master>./start.sh Server: $server>./start.sh --master --httpHost --httpPort --nodeHost --nodePort ...
  • 19. No impedence mismatch Java: public class Character { private String name; private List<Character> friends; private List<Character> foes; // ... } Json: {"name" : "Spider-man", "friends" : [{"name" : "Iceman"}] "foes" : [{"name" : "Kingpin"}]}
  • 20. Simple basic operations Put documents in buckets ... PUT /bucket/key Content-Type: application/json {...} Get documents from buckets ... GET /bucket/key Content-Type: application/json {...}
  • 21. Range queries Find documents in bucket with keys in a given range ... GET /bucket/range?comparator=comparator_name& startKey=start_key& endKey=end_key& timeToLive=max_age Content-Type: application/json {...}
  • 22. Built-in comparators Lexicographical Ascendant. Descendant. Numerical. Ascendant. Descendant.
  • 23. What if ... custom comparators? @AutoDetect(name="my-comparator") public class MyComparator implements terrastore.store.operators.Comparator { public int compare(String key1, String key2) { // ... } }
  • 24. Predicate queries Find documents in bucket satisfying a given predicate condition ... GET /bucket/predicate? predicate=type:expression Content-Type: application/json {...}
  • 25. Conditional put/get Conditionally put documents in buckets ... PUT /bucket/key? predicate=type:expression Content-Type: application/json {...} Conditionally get documents from buckets ... GET /bucket/key? predicate=type:expression Content-Type: application/json {...}
  • 26. Built-in predicate conditions JXPapth Based on X-Path. Find people whose name is 'Sergio': jxpath:/name[.='Sergio'] JavaScript Applies a JavaScript-like condition. Find people whose name is 'Sergio': js:value.name=='Sergio'
  • 27. What if ... custom conditions? @AutoDetect(name="my-condition") public class MyCondition implements terrastore.store.operators.Condition { public boolean isSatisfied(String key, Map<String, Object> value, String expression) { // ... } }
  • 28. Server-side updates Atomically execute complex updates to a document ... PUT /bucket/key/update?function=function_name& timeout=timeout_value Content-Type: application/json {...}
  • 29. Built-in update functions Atomic Counters Atomically increment/decrement/set-up one or more counters. Merge Merge the stored document with provided values. JavaScript custom update Update the stored document by executing a user- provided javascript function.
  • 30. What if ... custom functions? @AutoDetect(name="my-function") public class MyFunction implements terrastore.store.operators.Function { public Map<String, Object> apply(String key, Map<String, Object> value, Map<String, Object> parameters) { // ... } }
  • 31. Easy scale-out A command line parameter: $server>./start.sh --master --ensemble And a json configuration file: { "localCluster" : "apple", "discoveryInterval" : 5000, "clusters" : ["apple", "orange"], "seeds" : {"orange" : "192.168.1.2:6001"} }
  • 32. DSL-like Java APIs Fluent APIs. Http-based. Transparent (yet configurable) object conversion. // Create client: TerrastoreClient client = new TerrastoreClient("http://localhost:8080", new HTTPConnectionFactory()); // Create object: Person sbtourist = new Person("Sergio Bossa”, "sbtourist") // Put: client.bucket("people").key("1").put(person); // Get: sbtourist = client.bucket("people").key("1").get(Person.class);
  • 33. Support for other languages Clojure http://github.com/sbtourist/terrastore-cloj Python http://dnene.bitbucket.org/docs/pyterrastore Scala http://github.com/ssuravarapu/Terrastore-Scala-Client http://github.com/teigen/terrastore-scala Easy to add more!
  • 35. More! Backup Import/export documents to/from buckets. Events management Get notified of document updates. Third-party products integration. Write-behind. ActiveMQ integration for higher reliability. Custom data partitioning Retain control of where your data is placed. Indexing and searching Terrastore-Search. ElasticSearch integration. Cross-origin resource sharing support Integrate with browser-based clients.
  • 36. Now that I have an hammer ... Don't go blinded. Use the right tool for the job! Terrastore is best suited for: Data hot spots. Computational data. Complex, rich or variable data. Throw-away data.
  • 37. Final words ... engaging. Explore http://code.google.com/p/terrastore Download http://code.google.com/p/terrastore/downloads/list Hack http://code.google. com/p/terrastore/source/checkout Participate http://groups.google.com/group/terrastore- discussions Enjoy!
  • 38. Q&A Contact me on: http://twitter.com/sbtourist