SlideShare une entreprise Scribd logo
1  sur  38
Using Amazon SimpleDB
                with Rails




http://webonrails.com
Amazon SimpleDB
  ● Database web service advertised as:
      ● Simple, Flexible, Scalable, Fast, Reliable, Inexpensive



  ● No RDBMS: no SQL, no joins, no schema,
       no referential integrity, no transactions


  ● Ability to store, process and query data
   sets

http://webonrails.com
Amazon SimpleDB
  ● HTTP-Interface


  ● Pricing: Similar to other AWS




http://webonrails.com
Before we move
                            Further




http://webonrails.com
Let, have a look

                              at

                  Amazon SimpleDB
                   Common Terms


http://webonrails.com
Amazon SimpleDB Common
                 Terms
  ● Domain:
      storage container ~ table


  ● Item:
      ~ table rows accessed by ID ~ primary key


  ● Attribute:
      ~ table columns; every item may have a different
       set of upto 256 attributes
http://webonrails.com
Amazon SimpleDB Common
                 Terms
  ● Value:
      each Attribute may havemultiple Values, always
      varchar(1024)[]




http://webonrails.com
SimpleDB

                            Domain A
                                  Attributes
                    Items




                                 Values (multiple)




http://webonrails.com
PUT      (item, 123),
           (description, sweater),
           (color, blue),
           (color, red)


  PUT      (item, 456),
           (description, dress shirt),
           (color, white),
           (color, blue)



http://webonrails.com
Amazon SimpleDB API

  ● Domain level:
      ●   CREATE, LIST, DELETE


  ● Item level:
      ●   GET, PUT, DELETE attributes with values
      ●   QUERY for unordered item IDs by
          attribute values within one domain


  ● Beware: Eventual Consistency Approach!
http://webonrails.com
Benefits over traditional databases

  ●   No need to pre-define data types
      ●   'Size' can be 9 or XL or 1.5
  ●   Add attributes anytime
  ●   Attributes specifically for some items
  ●   Index all data




http://webonrails.com
API Summary

  ●   CreateDomain — Create a domain(100).
  ●   DeleteDomain — Delete a domain.
  ●   ListDomains — List all domains.
  ●   DomainMetadata — Retrieve information
      about the domain.




http://webonrails.com
API Summary

 ●   PutAttributes — Add or update an item and
     its attributes, or add attribute-value pairs to
     items that exist already.
 ●   GetAttributes — Retrieve an item and all or
     a subset of its attributes and values.
 ●   DeleteAttributes — Delete an item, an
     attribute, or an attribute value.



http://webonrails.com
API Summary

  ●   Query — Query the dataset using a query
      expression which specifies value tests on
      one or more attributes.


  ●   Supported value tests are:
      =, !=, <, > <=, >=, starts-with.
  [“price” < “12.00”] INTERSECTION [“color” = “green”].



  ●   Order results using the SORT operator
http://webonrails.com
API Summary

  ●   QueryWithAttributes — Enables developers
      to retrieve all or a subset of the information
      associated with items returned as a
      response to a particular query.




http://webonrails.com
SimpleDB vs S3
            S3                         SimpleDB
  ●   Stores raw data          ●   Stores indexed data


  ●   Uses higher dense        ●   Uses less dense
      storage drives               storage drives




http://webonrails.com
SimpleDB Limits (Cont...)
  ●   Domain size                       10 GB per domain
  ●   Domain size                       250,000,000 attribute name-
      value                             pairs
  ●   Domain name                       3-255 characters
  ●   Domains per account               100
  ●   Attribute name-value pairs/item   256
  ●   Attribute name length             1024 bytes
  ●   Attribute value length            1024 bytes
  ●   Item name length                  1024 bytes
  ●   All UTF-8 characters that are valid in XML documents are
      allowed in name/value.


http://webonrails.com
SimpleDB Limits

  ●   Attributes per PutAttributes operation   100
  ●   Maximum items in query response          250
  ●   Maximum query execution time             5 seconds
  ●   Maximum comparisons per predicate        10
  ●   Maximum predicates per query             10
      expression
  ●   Maximum response size for                1MB
      QueryWithAttributes




http://webonrails.com
Working with Numerical Data

  ●   SimpleDB is a schema-less data store
  ●   Everything is stored as a UTF-8 string value




http://webonrails.com
Working with Numerical Data

  ●   Ensure that every number is positive




http://webonrails.com
Working with Numerical Data

  ●   Ensure that every number is positive


               What about Negative
                    Numbers?



http://webonrails.com
Negative Numbers Offsets

  ●   Choose an offset
  ●   That should be arger than the smallest
      expected negative number in your data set
  ●   Ex:
      ●   if the smallest expected number in your data set is -12,
          choosing offset = 100 might be safe




http://webonrails.com
Negative Numbers Offsets

  The following is a sample original data set.
  14.58, -12.7, 20, 65, -23


  If you apply an offset of 100 the following is the resulting
  data set:


  114.58, 87.3, 120, 165, 77




http://webonrails.com
Zero Padding

  ●   Since simpleDB uses lexicographical
      comparisons “10” comes before “2”
  ●   If we zero pad the numbers to five digits,
      quot;00002quot; comes before quot;00010quot;




http://webonrails.com
Zero Padding

  ●   Since simpleDB uses lexicographical
      comparisons “10” comes before “2”
  ●   If we zero pad the numbers to five digits,
      quot;00002quot; comes before quot;00010quot;




http://webonrails.com
Dates
  ●   ISO 8601 format




http://webonrails.com
Query dataset

  ['attribute1' = 'value1']
  intersection
  not ['attribute2' = 'value2']
   union
  ['attribute3' = 'value3']




http://webonrails.com
SimpleDB with Rails




               AWS SDB
              Proxy Plugin

http://webonrails.com
http://webonrails.com
SimpleDB with Rails

  ●   Install aws-sdb gem
      ●   gem install aws-sdb


  ●   Install aws_sdb_proxy plugin:
      ●   script/plugin install
          git://github.com/bansalakhil/aws_sdb_proxy.git


      *Plugin originaly written by martin.rehfeld@glnetworks.de




http://webonrails.com
AWS SDB Proxy Plugin

  ●   Configure config/aws_sdb_proxy.yml
      ●   development:
             aws_access_key_id: <aws key>
             aws_secret_access_key: <aws secret key>
             port: 8888


  ●   Create new domain on Amazon SimpleDB
      ●   rake aws_sdb:create_domain DOMAIN=MyDataStore



http://webonrails.com
AWS SDB Proxy Plugin

  ●   Start AWS SDB proxy
      ●   rake aws_sdb:start_proxy_in_foreground




http://webonrails.com
Mapping RESTful URLs




http://webonrails.com
Using AWS SDB Proxy Plugin

  ●   Create demo ActiveResource model

           class Post < ActiveResource::Base
             self.site = quot;http://localhost:8888quot;
             self.prefix = quot;/MyDataStore/quot;
           end




http://webonrails.com
Lets try at script/console
  >> Article.create(:title => quot;This is my First articlequot;)
  => #<Article:0xb7005d04 @attributes={quot;updated_atquot;=>Sat Dec 13
    15:53:30 UTC 2008, quot;titlequot;=>quot;This is my First articlequot;,
    quot;idquot;=>601834...98, quot;created_atquot;=>Sat Dec 13 15:53:30 UTC 2008},
    @prefix_options={}>
  >> a = Article.create(:title => quot;This is my Second articlequot;)
  => #<Article:0xb6fe1f08 @attributes={quot;updated_atquot;=>Sat Dec 13
    15:53:52 UTC 2008, quot;titlequot;=>quot;This is my Second articlequot;,
    quot;idquot;=>112...9, quot;created_atquot;=>Sat Dec 13 15:53:52 UTC 2008},
    @prefix_options={}>
  >> a.body = quot;Nothingquot;
  >> a.save
  => true



http://webonrails.com
Lets try at script/console
  >> Article.find(:all).size
  => 2
  >> Article.find(:all, :from => :query, :params => quot;['title' starts-with 'This
    is' ]quot;)
  => [#<Article:0xb6f73080 @attributes={quot;updated_atquot;=>Sat Dec 13
    15:53:30 UTC 2008, quot;titlequot;=>quot;This is my First articlequot;, quot;idquot;=>60...98,
    quot;created_atquot;=>Sat Dec 13 15:53:30 UTC 2008},
    @prefix_options={}>, #<Article:0xb6f7306c
    @attributes={quot;updated_atquot;=>Sat Dec 13 15:54:14 UTC 2008,
    quot;bodyquot;=>quot;Nothingquot;, quot;titlequot;=>quot;This is my Second articlequot;,
    quot;idquot;=>11...79, quot;created_atquot;=>Sat Dec 13 15:53:52 UTC 2008},
    @prefix_options={}>]




http://webonrails.com
References

  ●   http://aws.amazon.com/simpledb/
  ●   http://inside.glnetworks.de




http://webonrails.com
Thanks
                             Akhil Bansal
                        http://webonrails.com




http://webonrails.com

Contenu connexe

Tendances

Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desaijmsthakur
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011Alexander Klimetschek
 
OpenERP and Perl
OpenERP and PerlOpenERP and Perl
OpenERP and PerlOpusVL
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling RewriterJustin Edelson
 
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019Vlad Mihalcea
 
Play + scala + reactive mongo
Play + scala + reactive mongoPlay + scala + reactive mongo
Play + scala + reactive mongoMax Kremer
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play frameworkFelipe
 
Rails and Legacy Databases - RailsConf 2009
Rails and Legacy Databases - RailsConf 2009Rails and Legacy Databases - RailsConf 2009
Rails and Legacy Databases - RailsConf 2009Brian Hogan
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsVisual Engineering
 
Ruby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkRuby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkPankaj Bhageria
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL Suraj Bang
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSencha
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with TerracottaAlex Miller
 
Amazon Web Services for PHP Developers
Amazon Web Services for PHP DevelopersAmazon Web Services for PHP Developers
Amazon Web Services for PHP DevelopersJeremy Lindblom
 
DOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A RideDOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A RideMatthew McCullough
 
OGSA-DAI DQP: A Developer's View
OGSA-DAI DQP: A Developer's ViewOGSA-DAI DQP: A Developer's View
OGSA-DAI DQP: A Developer's ViewBartosz Dobrzelecki
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleRaimonds Simanovskis
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingWorking With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingNeo4j
 

Tendances (20)

Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
 
OpenERP and Perl
OpenERP and PerlOpenERP and Perl
OpenERP and Perl
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019 Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
Awesome SQL Tips and Tricks - Voxxed Days Cluj - 2019
 
Play + scala + reactive mongo
Play + scala + reactive mongoPlay + scala + reactive mongo
Play + scala + reactive mongo
 
Short intro to scala and the play framework
Short intro to scala and the play frameworkShort intro to scala and the play framework
Short intro to scala and the play framework
 
Rails and Legacy Databases - RailsConf 2009
Rails and Legacy Databases - RailsConf 2009Rails and Legacy Databases - RailsConf 2009
Rails and Legacy Databases - RailsConf 2009
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
 
Scala active record
Scala active recordScala active record
Scala active record
 
Ruby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkRuby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails framework
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
 
PHP and databases
PHP and databasesPHP and databases
PHP and databases
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with Terracotta
 
Amazon Web Services for PHP Developers
Amazon Web Services for PHP DevelopersAmazon Web Services for PHP Developers
Amazon Web Services for PHP Developers
 
DOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A RideDOSUG Taking Apache Camel For A Ride
DOSUG Taking Apache Camel For A Ride
 
OGSA-DAI DQP: A Developer's View
OGSA-DAI DQP: A Developer's ViewOGSA-DAI DQP: A Developer's View
OGSA-DAI DQP: A Developer's View
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on Oracle
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingWorking With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and Modeling
 

En vedette

Amazon elastic block store (ebs) and
Amazon elastic block store (ebs) andAmazon elastic block store (ebs) and
Amazon elastic block store (ebs) andlurdhu agnes
 
Consistent High IO Performance with Amazon Elastic Block Store
Consistent High IO Performance with Amazon Elastic Block StoreConsistent High IO Performance with Amazon Elastic Block Store
Consistent High IO Performance with Amazon Elastic Block StoreAmazon Web Services
 
AWS Webcast - Introduction to EBS
AWS Webcast - Introduction to EBS AWS Webcast - Introduction to EBS
AWS Webcast - Introduction to EBS Amazon Web Services
 
Introduction to Block and File storage on AWS
Introduction to Block and File storage on AWSIntroduction to Block and File storage on AWS
Introduction to Block and File storage on AWSAmazon Web Services
 
Deep Dive on Amazon Elastic Block Store
Deep Dive on Amazon Elastic Block StoreDeep Dive on Amazon Elastic Block Store
Deep Dive on Amazon Elastic Block StoreAmazon Web Services
 
AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)
AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)
AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)Amazon Web Services
 
Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...
Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...
Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...Amazon Web Services
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web ServicesAmazon Web Services
 

En vedette (9)

Amazon elastic block store (ebs) and
Amazon elastic block store (ebs) andAmazon elastic block store (ebs) and
Amazon elastic block store (ebs) and
 
Amazon simple db
Amazon simple dbAmazon simple db
Amazon simple db
 
Consistent High IO Performance with Amazon Elastic Block Store
Consistent High IO Performance with Amazon Elastic Block StoreConsistent High IO Performance with Amazon Elastic Block Store
Consistent High IO Performance with Amazon Elastic Block Store
 
AWS Webcast - Introduction to EBS
AWS Webcast - Introduction to EBS AWS Webcast - Introduction to EBS
AWS Webcast - Introduction to EBS
 
Introduction to Block and File storage on AWS
Introduction to Block and File storage on AWSIntroduction to Block and File storage on AWS
Introduction to Block and File storage on AWS
 
Deep Dive on Amazon Elastic Block Store
Deep Dive on Amazon Elastic Block StoreDeep Dive on Amazon Elastic Block Store
Deep Dive on Amazon Elastic Block Store
 
AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)
AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)
AWS re:Invent 2016: Deep Dive on Amazon Elastic Block Store (STG301)
 
Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...
Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...
Overview and Best Practices for Amazon Elastic Block Store - September 2016 W...
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
 

Similaire à Using Amazon Simple Db With Rails

Scaling Rails Sites by default
Scaling Rails Sites by defaultScaling Rails Sites by default
Scaling Rails Sites by defaultYi-Ting Cheng
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...Ivanti
 
Rails database optimization
Rails database optimizationRails database optimization
Rails database optimizationKarsten Meier
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryWilliam Candillon
 
Google apps script database abstraction exposed version
Google apps script database abstraction   exposed versionGoogle apps script database abstraction   exposed version
Google apps script database abstraction exposed versionBruce McPherson
 
Cloud Computing in PHP With the Amazon Web Services
Cloud Computing in PHP With the Amazon Web ServicesCloud Computing in PHP With the Amazon Web Services
Cloud Computing in PHP With the Amazon Web ServicesAmazon Web Services
 
Adding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSASAdding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSASsumedha.r
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2Adam Klein
 
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreScaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreDropsolid
 
Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemdelagoya
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula Sorin Chiprian
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardSV Ruby on Rails Meetup
 
Empowering the AWS DynamoDB™ application developer with Alternator
Empowering the AWS DynamoDB™ application developer with AlternatorEmpowering the AWS DynamoDB™ application developer with Alternator
Empowering the AWS DynamoDB™ application developer with AlternatorScyllaDB
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)Kashif Imran
 
Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))
Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))
Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))Sriram Krishnan
 

Similaire à Using Amazon Simple Db With Rails (20)

Workshop 17: EmberJS parte II
Workshop 17: EmberJS parte IIWorkshop 17: EmberJS parte II
Workshop 17: EmberJS parte II
 
Scaling Rails Sites by default
Scaling Rails Sites by defaultScaling Rails Sites by default
Scaling Rails Sites by default
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
 
Rails database optimization
Rails database optimizationRails database optimization
Rails database optimization
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQuery
 
Google apps script database abstraction exposed version
Google apps script database abstraction   exposed versionGoogle apps script database abstraction   exposed version
Google apps script database abstraction exposed version
 
Cloud Computing in PHP With the Amazon Web Services
Cloud Computing in PHP With the Amazon Web ServicesCloud Computing in PHP With the Amazon Web Services
Cloud Computing in PHP With the Amazon Web Services
 
Adding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSASAdding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSAS
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2
 
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreScaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
 
Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problem
 
AWS Java SDK @ scale
AWS Java SDK @ scaleAWS Java SDK @ scale
AWS Java SDK @ scale
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
 
Empowering the AWS DynamoDB™ application developer with Alternator
Empowering the AWS DynamoDB™ application developer with AlternatorEmpowering the AWS DynamoDB™ application developer with Alternator
Empowering the AWS DynamoDB™ application developer with Alternator
 
Php summary
Php summaryPhp summary
Php summary
 
Rack
RackRack
Rack
 
Auto Scaling Groups
Auto Scaling GroupsAuto Scaling Groups
Auto Scaling Groups
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)
 
Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))
Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))
Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))
 

Dernier

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Dernier (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Using Amazon Simple Db With Rails

  • 1. Using Amazon SimpleDB with Rails http://webonrails.com
  • 2. Amazon SimpleDB ● Database web service advertised as: ● Simple, Flexible, Scalable, Fast, Reliable, Inexpensive ● No RDBMS: no SQL, no joins, no schema, no referential integrity, no transactions ● Ability to store, process and query data sets http://webonrails.com
  • 3. Amazon SimpleDB ● HTTP-Interface ● Pricing: Similar to other AWS http://webonrails.com
  • 4. Before we move Further http://webonrails.com
  • 5. Let, have a look at Amazon SimpleDB Common Terms http://webonrails.com
  • 6. Amazon SimpleDB Common Terms ● Domain: storage container ~ table ● Item: ~ table rows accessed by ID ~ primary key ● Attribute: ~ table columns; every item may have a different set of upto 256 attributes http://webonrails.com
  • 7. Amazon SimpleDB Common Terms ● Value: each Attribute may havemultiple Values, always varchar(1024)[] http://webonrails.com
  • 8. SimpleDB Domain A Attributes Items Values (multiple) http://webonrails.com
  • 9. PUT (item, 123), (description, sweater), (color, blue), (color, red) PUT (item, 456), (description, dress shirt), (color, white), (color, blue) http://webonrails.com
  • 10. Amazon SimpleDB API ● Domain level: ● CREATE, LIST, DELETE ● Item level: ● GET, PUT, DELETE attributes with values ● QUERY for unordered item IDs by attribute values within one domain ● Beware: Eventual Consistency Approach! http://webonrails.com
  • 11. Benefits over traditional databases ● No need to pre-define data types ● 'Size' can be 9 or XL or 1.5 ● Add attributes anytime ● Attributes specifically for some items ● Index all data http://webonrails.com
  • 12. API Summary ● CreateDomain — Create a domain(100). ● DeleteDomain — Delete a domain. ● ListDomains — List all domains. ● DomainMetadata — Retrieve information about the domain. http://webonrails.com
  • 13. API Summary ● PutAttributes — Add or update an item and its attributes, or add attribute-value pairs to items that exist already. ● GetAttributes — Retrieve an item and all or a subset of its attributes and values. ● DeleteAttributes — Delete an item, an attribute, or an attribute value. http://webonrails.com
  • 14. API Summary ● Query — Query the dataset using a query expression which specifies value tests on one or more attributes. ● Supported value tests are: =, !=, <, > <=, >=, starts-with. [“price” < “12.00”] INTERSECTION [“color” = “green”]. ● Order results using the SORT operator http://webonrails.com
  • 15. API Summary ● QueryWithAttributes — Enables developers to retrieve all or a subset of the information associated with items returned as a response to a particular query. http://webonrails.com
  • 16. SimpleDB vs S3 S3 SimpleDB ● Stores raw data ● Stores indexed data ● Uses higher dense ● Uses less dense storage drives storage drives http://webonrails.com
  • 17. SimpleDB Limits (Cont...) ● Domain size 10 GB per domain ● Domain size 250,000,000 attribute name- value pairs ● Domain name 3-255 characters ● Domains per account 100 ● Attribute name-value pairs/item 256 ● Attribute name length 1024 bytes ● Attribute value length 1024 bytes ● Item name length 1024 bytes ● All UTF-8 characters that are valid in XML documents are allowed in name/value. http://webonrails.com
  • 18. SimpleDB Limits ● Attributes per PutAttributes operation 100 ● Maximum items in query response 250 ● Maximum query execution time 5 seconds ● Maximum comparisons per predicate 10 ● Maximum predicates per query 10 expression ● Maximum response size for 1MB QueryWithAttributes http://webonrails.com
  • 19. Working with Numerical Data ● SimpleDB is a schema-less data store ● Everything is stored as a UTF-8 string value http://webonrails.com
  • 20. Working with Numerical Data ● Ensure that every number is positive http://webonrails.com
  • 21. Working with Numerical Data ● Ensure that every number is positive What about Negative Numbers? http://webonrails.com
  • 22. Negative Numbers Offsets ● Choose an offset ● That should be arger than the smallest expected negative number in your data set ● Ex: ● if the smallest expected number in your data set is -12, choosing offset = 100 might be safe http://webonrails.com
  • 23. Negative Numbers Offsets The following is a sample original data set. 14.58, -12.7, 20, 65, -23 If you apply an offset of 100 the following is the resulting data set: 114.58, 87.3, 120, 165, 77 http://webonrails.com
  • 24. Zero Padding ● Since simpleDB uses lexicographical comparisons “10” comes before “2” ● If we zero pad the numbers to five digits, quot;00002quot; comes before quot;00010quot; http://webonrails.com
  • 25. Zero Padding ● Since simpleDB uses lexicographical comparisons “10” comes before “2” ● If we zero pad the numbers to five digits, quot;00002quot; comes before quot;00010quot; http://webonrails.com
  • 26. Dates ● ISO 8601 format http://webonrails.com
  • 27. Query dataset ['attribute1' = 'value1'] intersection not ['attribute2' = 'value2'] union ['attribute3' = 'value3'] http://webonrails.com
  • 28. SimpleDB with Rails AWS SDB Proxy Plugin http://webonrails.com
  • 30. SimpleDB with Rails ● Install aws-sdb gem ● gem install aws-sdb ● Install aws_sdb_proxy plugin: ● script/plugin install git://github.com/bansalakhil/aws_sdb_proxy.git *Plugin originaly written by martin.rehfeld@glnetworks.de http://webonrails.com
  • 31. AWS SDB Proxy Plugin ● Configure config/aws_sdb_proxy.yml ● development: aws_access_key_id: <aws key> aws_secret_access_key: <aws secret key> port: 8888 ● Create new domain on Amazon SimpleDB ● rake aws_sdb:create_domain DOMAIN=MyDataStore http://webonrails.com
  • 32. AWS SDB Proxy Plugin ● Start AWS SDB proxy ● rake aws_sdb:start_proxy_in_foreground http://webonrails.com
  • 34. Using AWS SDB Proxy Plugin ● Create demo ActiveResource model class Post < ActiveResource::Base self.site = quot;http://localhost:8888quot; self.prefix = quot;/MyDataStore/quot; end http://webonrails.com
  • 35. Lets try at script/console >> Article.create(:title => quot;This is my First articlequot;) => #<Article:0xb7005d04 @attributes={quot;updated_atquot;=>Sat Dec 13 15:53:30 UTC 2008, quot;titlequot;=>quot;This is my First articlequot;, quot;idquot;=>601834...98, quot;created_atquot;=>Sat Dec 13 15:53:30 UTC 2008}, @prefix_options={}> >> a = Article.create(:title => quot;This is my Second articlequot;) => #<Article:0xb6fe1f08 @attributes={quot;updated_atquot;=>Sat Dec 13 15:53:52 UTC 2008, quot;titlequot;=>quot;This is my Second articlequot;, quot;idquot;=>112...9, quot;created_atquot;=>Sat Dec 13 15:53:52 UTC 2008}, @prefix_options={}> >> a.body = quot;Nothingquot; >> a.save => true http://webonrails.com
  • 36. Lets try at script/console >> Article.find(:all).size => 2 >> Article.find(:all, :from => :query, :params => quot;['title' starts-with 'This is' ]quot;) => [#<Article:0xb6f73080 @attributes={quot;updated_atquot;=>Sat Dec 13 15:53:30 UTC 2008, quot;titlequot;=>quot;This is my First articlequot;, quot;idquot;=>60...98, quot;created_atquot;=>Sat Dec 13 15:53:30 UTC 2008}, @prefix_options={}>, #<Article:0xb6f7306c @attributes={quot;updated_atquot;=>Sat Dec 13 15:54:14 UTC 2008, quot;bodyquot;=>quot;Nothingquot;, quot;titlequot;=>quot;This is my Second articlequot;, quot;idquot;=>11...79, quot;created_atquot;=>Sat Dec 13 15:53:52 UTC 2008}, @prefix_options={}>] http://webonrails.com
  • 37. References ● http://aws.amazon.com/simpledb/ ● http://inside.glnetworks.de http://webonrails.com
  • 38. Thanks Akhil Bansal http://webonrails.com http://webonrails.com