Writing applications for Cloud Foundry using Spring and...
Transcript of Writing applications for Cloud Foundry using Spring and...
![Page 1: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/1.jpg)
© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Thomas Risberg, VMware <[email protected]> - @trisberg
Jared Rosoff, 10gen <[email protected]> - @forjared
Writing applications for Cloud Foundry using Spring and MongoDB
1Wednesday, October 26, 11
![Page 2: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/2.jpg)
Outline
What we will cover:• Introduction to Cloud Foundry• Introduction to MongoDB• Spring Data support for MongoDB
– Using the MongoTemplate– Using the Mongo Repository support
• Why run MongoDB in the cloud?
2
2Wednesday, October 26, 11
![Page 3: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/3.jpg)
What is Cloud Foundry?
• Cloud Foundry is a PaaS– The application platform will be delivered as a service in the
cloud era– The industry calls this platform as a service (PaaS)
• PaaS makes it much easier to deploy, run and scale applications
• But PaaS solutions in the market have fatal flaws today– Limited in framework, application services and/or cloud support
• Cloud Foundry aim to fix that…
3
3Wednesday, October 26, 11
![Page 4: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/4.jpg)
Characteristics of PaaS
The application platform for the cloud era• Integrated software stack• Application execution engine• Self-service application deployment • Automated application infrastructure provisioning • Curated, updated and operated as a service
4
4Wednesday, October 26, 11
![Page 5: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/5.jpg)
Cloud Foundry – The first open PaaS
• Self-service application execution engine– Build applications with latest high productivity frameworks
• Automation engine for deployment and lifecycle management– Deploy and cloud-scale applications in seconds
• Open architecture– Choice of clouds for deployment– Choice of industry-standard frameworks– Choice of application infrastructure services– Extensible architecture to “digest” future cloud innovation– Available as open source
5
5Wednesday, October 26, 11
![Page 6: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/6.jpg)
Choice of frameworks
6
.js
6Wednesday, October 26, 11
![Page 7: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/7.jpg)
Choice of application services
7Application Service Interface
Data Services
Other Services
Msg Services
.js
7Wednesday, October 26, 11
![Page 8: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/8.jpg)
Choice of clouds
8
Clou
d Pr
ovide
r Inte
rface
Application Service Interface
Private Clouds
PublicClouds
MicroClouds
Data Services
Other Services
Msg Services
.js
.COM
Partners
8Wednesday, October 26, 11
![Page 9: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/9.jpg)
9
9Wednesday, October 26, 11
![Page 10: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/10.jpg)
MongoDB
10
Horizontally Scalable
{ author: “steve”, date: new Date(), text: “About MongoDB...”, tags: [“tech”, “database”]}
Document Oriented
Application
High Performance
10Wednesday, October 26, 11
![Page 11: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/11.jpg)
Why MongoDB
• Double click serving 400,000 ads / second • People writing their own datastores• Caching is de rigueur • Complex ORM frameworks• Computer architecture trends • Cloud computing
11
11Wednesday, October 26, 11
![Page 12: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/12.jpg)
12
Launch+90 Days
+1 Year
Costs go up!
12Wednesday, October 26, 11
![Page 13: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/13.jpg)
Productivity
13
Project Start+90 Days
+1 Year
Great!
Denormalize data model
Stop using joins
Custom caching
Custom sharding
13Wednesday, October 26, 11
![Page 14: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/14.jpg)
Data models
14
14Wednesday, October 26, 11
![Page 15: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/15.jpg)
From tables to Documents
15
{ title: ‘MongoDB’, contributors: [ { name: ‘Eliot Horowitz’, email: ‘[email protected]’ }, { name: ‘Dwight Merriman’, email: ‘[email protected]’ } ], model: { relational: false, awesome: true }
15Wednesday, October 26, 11
![Page 16: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/16.jpg)
Documents
16
> p = {author: “roger”, date: new Date(), text: “about mongoDB...”, tags: [“tech”, “databases”]}
> db.posts.save(p)
16Wednesday, October 26, 11
![Page 17: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/17.jpg)
Querying
17
> db.posts.find()
> { _id : ObjectId("4c4ba5c0672c685e5e8aabf3"), author : "roger", date : "Sat Jul 24 2010 19:47:11", text : "About MongoDB...", tags : [ "tech", "databases" ] }
17Wednesday, October 26, 11
![Page 18: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/18.jpg)
Secondary Indexes
18
// 1 means ascending, -1 means descending > db.posts.ensureIndex({author: 1}) > db.posts.find({author: 'roger'}) > { _id : ObjectId("4c4ba5c0672c685e5e8aabf3"), author : "roger", ... }
18Wednesday, October 26, 11
![Page 19: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/19.jpg)
Conditional Query Operators
19
// find posts with any tags > db.posts.find( {tags: {$exists: true }} )
// find posts matching a regular expression> db.posts.find( {author: /^rog*/i } )
// count posts by author> db.posts.find( {author: ‘roger’} ).count()
$all, $exists, $mod, $ne, $in, $nin, $nor, $or, $size, $type, $lt, $lte, $gt, $gte
19Wednesday, October 26, 11
![Page 20: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/20.jpg)
Atomic Updates
$set, $unset, $inc, $push, $pushAll, $pull, $pullAll, $bit
20
> comment = { author: “fred”, date: new Date(), text: “Best Movie Ever”}
> db.posts.update( { _id: “...” }, $push: {comments: comment} );
20Wednesday, October 26, 11
![Page 21: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/21.jpg)
Nested Documents
21
{ _id : ObjectId("4c4ba5c0672c685e5e8aabf3"), author : "roger", date : "Sat Apr 24 2011 19:47:11", text : "About MongoDB...", tags : [ "tech", "databases" ], comments : [ { author : "Fred", date : "Sat Apr 25 2010 20:51:03 GMT-0700", text : "Best Post Ever!" } ]}
21Wednesday, October 26, 11
![Page 22: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/22.jpg)
Advanced indexing
22
// Index nested documents> db.posts.ensureIndex( “comments.author”: 1)> db.posts.find({‘comments.author’:’Fred’})
// Index on tags (multi-key index)> db.posts.ensureIndex( tags: 1)> db.posts.find( { tags: ‘tech’ } )
// geospatial index> db.posts.ensureIndex( “author.location”: “2d” )> db.posts.find( “author.location”: { $near : [22,42] } )
22Wednesday, October 26, 11
![Page 23: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/23.jpg)
Rich Documents
23
{ _id : ObjectId("4c4ba5c0672c685e5e8aabf3"), line_items : [ { sku: ‘tt-123’, name: ‘Coltrane: Impressions’ }, { sku: ‘tt-457’, name: ‘Davis: Kind of Blue’ } ], address : { name: ‘Banker’, street: ‘111 Main’, zip: 10010 }, payment: { cc: 4567, exp: Date(2011, 7, 7) },
subtotal: 2355}
23Wednesday, October 26, 11
![Page 24: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/24.jpg)
© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo
Cloud Foundry and Mongo DB
24
24Wednesday, October 26, 11
![Page 25: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/25.jpg)
Spring Data Intoduction
What is Spring Data all about?• Bring classic Spring value propositions to NOSQL
– Productivity– Programming model consistency
• Support for a wide range of NOSQL databases• Also, support for new features for JDBC and JPA• Support for other data related projects like Hadoop and
Gemfire
25
25Wednesday, October 26, 11
![Page 26: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/26.jpg)
Spring Data MongoDB Support
Spring Data support for MongoDB:• MongoTemplate✓MongoConverter interface for mapping Mongo documents
• Built-in Advanced Mapping– Annotation based (@Document, @Id, @DbRef)
• MappingMongoConverter for POJO mapping support• Leverage Spring 3.0 TypeConverters and SpEL
✓Exception translation✓Java based Query, Criteria, and Update DSLs
• MongoRepository✓Built on Spring Data JPA (Hades) support for JPA Repositories✓QueryDSL integration to support type-safe queries.
26
26Wednesday, October 26, 11
![Page 27: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/27.jpg)
Working with POJOs
27
@Documentpublic class Book { private String title; @DBRef private Author author; @Id private String isbn; private BigDecimal price; private Date published; private Set<String> categories;
// getters and setters}
@Documentpublic class Author { @Id @SuppressWarnings("unused") private String id; private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }}
27Wednesday, October 26, 11
![Page 28: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/28.jpg)
Mongo Template CRUD Methods
28
Mongo mongo = new Mongo("localhost", 27017);MongoDbFactory mongoDbFactory =
new SimpleMongoDbFactory(mongo, "db");MongoTemplate mongoTemplate = new MongoTemplate(mongoDbFactory);
mongoTemplate.insert(book);
List<Book> books = mongoTemplate.findAll(Book.class);
Book book = mongoTemplate.findOne(query, Book.class);
mongoTemplate.save(book);
mongoTemplate.remove(query, Book.class);
28Wednesday, October 26, 11
![Page 29: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/29.jpg)
Querying
29
public List<Book> findByCategoriesOrYear(Set<String> categories, String year) {! String[] categoriesToMatch;! if (categories == null) {! ! categoriesToMatch = new String[] {};! }! else {! ! categoriesToMatch = categories.toArray(new String[categories.size()]);! }! Date startDate = null;! if (year != null && year.length() == 4) {! ! DateFormat formatter = new SimpleDateFormat("yyyy-dd-MM");! ! try {! ! ! startDate = formatter.parse(year + "-01-01");! ! } catch (ParseException e) {}! }! Criteria searchCriteria = null;! if (startDate != null) {
! ! searchCriteria = Criteria.where("published").gte(startDate);
! }! else {! ! searchCriteria = new Criteria();! }! if (categoriesToMatch.length > 0) {! !
! ! searchCriteria.and("categories").in((Object[])categoriesToMatch);
! }
! Query query = new Query(searchCriteria);! return mongoTemplate.find(query, Book.class);}
29Wednesday, October 26, 11
![Page 30: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/30.jpg)
Cloud Foundry MongoDB Support
Namespace support for MongoDB
30
<dependency> <groupId>org.cloudfoundry</groupId> <artifactId>cloudfoundry-runtime</artifactId> <version>0.8.1</version></dependency>
<repository> <id>org.springframework.maven.milestone</id> <name>Spring Framework Maven Milestone Repository</name> <url>http://maven.springframework.org/milestone</url></repository>
<cloud:mongo-db-factory id="mongoDbFactory" write-concern="FSYNC_SAFE"> <cloud:mongo-options connections-per-host="10" max-wait-time="2000" /></cloud:mongo-db-factory>
30Wednesday, October 26, 11
![Page 31: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/31.jpg)
© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo
MongoTemplate example: https://github.com/trisberg/springone-mongotemplate
31
31Wednesday, October 26, 11
![Page 32: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/32.jpg)
Spring Data Repository
Spring Data Repository basics:• Generic repository implementation • Basic CRUD (create, read, update and delete) methods• Generating code for queries defined in repository interface
– findAll– findByName ...
• Pagination and sorting support• Currently has JPA and Mongo implementations
32
32Wednesday, October 26, 11
![Page 33: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/33.jpg)
Spring Data Repository Interfaces
33
CrudRepository
PagingAndSortingRepository
33Wednesday, October 26, 11
![Page 34: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/34.jpg)
Spring Data Repository Query Methods
34
Spring Data Repository query methods:
and more, see reference docs ...
34Wednesday, October 26, 11
![Page 35: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/35.jpg)
Mongo Repository Example
35
public interface BookRepository extends Repository<Book, String> { Book save(Book book); Book findOne(String isbn); void delete(String isbn); List<Book> findAll();
List<Book> findByPublishedGreaterThan(Date date); List<Book> findByCategoriesIn(String[] categories);
List<Book> findByPublishedGreaterThanAndCategoriesIn(Date date, String[] categories);
}
35Wednesday, October 26, 11
![Page 36: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/36.jpg)
© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo
Mongo Repository example: https://github.com/trisberg/springone-repository
36
36Wednesday, October 26, 11
![Page 37: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/37.jpg)
QueryDSL Repository
QueryDSL allows you to build typesafe queries using Java for JPA, SQL, MongoDB and more
• Generic repository implementation • Code completion in IDE• No Strings
– reference types and properties safely – easier refactoring
• Incremental query definition is easier• Annotation preprocessor generates query types
37
37Wednesday, October 26, 11
![Page 38: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/38.jpg)
© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Demo
Mongo QueryDSL Repository example: https://github.com/trisberg/springone-repo-qdsl
38
38Wednesday, October 26, 11
![Page 39: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/39.jpg)
Why run MongoDB in the cloud?
39
39Wednesday, October 26, 11
![Page 40: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/40.jpg)
Typical scaling approaches don’t work
40
40Wednesday, October 26, 11
![Page 41: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/41.jpg)
MongoDB scales out
41
41Wednesday, October 26, 11
![Page 42: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/42.jpg)
MongoDB scales out
42
42Wednesday, October 26, 11
![Page 43: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/43.jpg)
MongoDB scales out
43
43Wednesday, October 26, 11
![Page 44: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/44.jpg)
MongoDB scales out
44
44Wednesday, October 26, 11
![Page 45: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/45.jpg)
MongoDB in the cloud
• Elastic database capacity– Add more storage, compute, memory dynamically
• Portable across environments – Public cloud – Private cloud – Micro cloud
• Simplifies operations– No need to engineer solutions for one-off hardware platforms– “Just another VM”
45
45Wednesday, October 26, 11
![Page 46: Writing applications for Cloud Foundry using Spring and MongoDBwhiteship.me/wp-content/uploads/2011/11/SpringOne2… · · 2011-11-01Writing applications for Cloud Foundry using](https://reader036.fdocuments.net/reader036/viewer/2022062413/5aec95f77f8b9ab24d9039f0/html5/thumbnails/46.jpg)
© 2011 SpringOne 2GX 2011. All rights reserved. Do not distribute without permission.
Q&A
46
46Wednesday, October 26, 11