Développement logiciel pour le Cloud (TLC)

publicité
Table of Contents
Développement logiciel pour le Cloud (TLC)
1
Introduction
2
Developing Java applications in AppEngine
3
The Data Store
4
Background actions in AppEngine
5
Conclusion
3. PaaS: the example of Google AppEngine
Guillaume Pierre
Université de Rennes 1
Fall 2012
http://www.globule.org/~gpierre/
Développement logiciel pour le Cloud (TLC)
1 / 35
Table of Contents
1
Developing Java applications in AppEngine
3
The Data Store
2 / 35
What is Google AppEngine?
Introduction
2
Développement logiciel pour le Cloud (TLC)
A Web application hosting platform
I Python, Java, Go.
I Automatic scaling and load balancing
Two data backends
I SQL, NoSQL
4
Background actions in AppEngine
5
Conclusion
Développement logiciel pour le Cloud (TLC)
Integration with Google accounts for authentication etc.
Introduction
1 / 35
Développement logiciel pour le Cloud (TLC)
Introduction
2 / 35
AppEngine customers
Développement logiciel pour le Cloud (TLC)
AppEngine customers
Introduction
3 / 35
AppEngine usage
Développement logiciel pour le Cloud (TLC)
Développement logiciel pour le Cloud (TLC)
Introduction
4 / 35
Introduction
6 / 35
AppEngine advertisement
Introduction
5 / 35
Développement logiciel pour le Cloud (TLC)
AppEngine advertisement
Développement logiciel pour le Cloud (TLC)
Application lifecycle
Introduction
6 / 35
AppEngine SDK
Développement logiciel pour le Cloud (TLC)
Introduction
7 / 35
Introduction
9 / 35
AppEngine code deployment
AppEngine provides a convenient SDK
I A local server where you can develop and test
I Eclipse plugin
Deploy code in the cloud after testing it locally
Développement logiciel pour le Cloud (TLC)
Introduction
8 / 35
Développement logiciel pour le Cloud (TLC)
AppEngine console
Développement logiciel pour le Cloud (TLC)
AppEngine pricing
Introduction
10 / 35
AppEngine APIs
Développement logiciel pour le Cloud (TLC)
Développement logiciel pour le Cloud (TLC)
Introduction
11 / 35
Developing Java applications in AppEngine
13 / 35
Table of Contents
Introduction
12 / 35
1
Introduction
2
Developing Java applications in AppEngine
3
The Data Store
4
Background actions in AppEngine
5
Conclusion
Développement logiciel pour le Cloud (TLC)
Directory layout
GuestbookServlet.java
Java applications use a classical directory structure
Développement logiciel pour le Cloud (TLC)
Developing Java applications in AppEngine
You can write regular servlet code
14 / 35
web.xml
Développement logiciel pour le Cloud (TLC)
Developing Java applications in AppEngine
15 / 35
appengine-web.xml
Regular servlet conguration le
AppEngine requires one additional conguration le
I To explain AppEngine
Développement logiciel pour le Cloud (TLC)
Developing Java applications in AppEngine
16 / 35
Développement logiciel pour le Cloud (TLC)
how
to host this application
Developing Java applications in AppEngine
17 / 35
AppEngine can connect directly to Google accounts
Great: the development server knows how to
Beware: you are becoming locked in. . .
Développement logiciel pour le Cloud (TLC)
AppEngine also supports JSP
emulate Google login
Developing Java applications in AppEngine
18 / 35
Table of Contents
1
Développement logiciel pour le Cloud (TLC)
Developing Java applications in AppEngine
Scalability issues
So far our applications have been
Introduction
I Copy the application on
2
Developing Java applications in AppEngine
3
The Data Store
19 / 35
stateless
N servers
I Process any reauest on any server
I Very easy to scale!
Problems start when applications want to
store data
I Replication and consistency issues
4
I Traditional replication usually scales very badly
Background actions in AppEngine
I Each server processes
F Increasing
5
reduces the Read load for each server
F When the Write load saturates a server, the system cannot scale any
Conclusion
Développement logiciel pour le Cloud (TLC)
N
1
N × Reads + Writes
more
The Data Store
20 / 35
Développement logiciel pour le Cloud (TLC)
The Data Store
21 / 35
Scalability of a master-slave replicated database
The Google Datastore
20000
Throughput
(transactions/second)
The Datastore is a non-relational database
15000
I We will see more on NoSQL next week. . .
Applications can store
10000
entities
in the data store
Entities are organize hierarchically
I Each entity has one
5000
key
(to dene its identity)
I Each entity can contain any number of key-value pairs
I Entities
may have one parent entity
F All entities under the same ancestor form an
entity group
0
0
10
20
30
40
50
Number of server machines
Développement logiciel pour le Cloud (TLC)
60
The Data Store
22 / 35
What's the catch?
Développement logiciel pour le Cloud (TLC)
The Data Store
23 / 35
The Data Store
25 / 35
Storing all greeting in a single entity group
Each query spanning a single entity group is
guaranteed to be
strongly consistent
I To make things simple: you can ignore the fact that data are replicated
Queries spanning more than one entity group have
no consistency
guarantee
I You may see in-between states that are not supposed to happen
What's the
real catch?
I You can issue at most
one update per entity group per second
I If your application generates more updates you are forced to split data
in many independent entity groups
Développement logiciel pour le Cloud (TLC)
The Data Store
24 / 35
Développement logiciel pour le Cloud (TLC)
Reading greetings
Table of Contents
Développement logiciel pour le Cloud (TLC)
The Data Store
26 / 35
AppEngine imposes limits on requests
1
Introduction
2
Developing Java applications in AppEngine
3
The Data Store
4
Background actions in AppEngine
5
Conclusion
Développement logiciel pour le Cloud (TLC)
Background actions in AppEngine
27 / 35
Background actions in AppEngine
29 / 35
Example: processing logs
AppEngine requests are killed after 60 seconds of execution
Each server instance has little memory (128 MB)
Server instances are created/destroyed automatically (they should not
keep state)
No background tasks!
I Processing logs
I Scanning the database periodically
I Etc.
The cron service is designed for periodic work
I A task can execute for up to 10 minutes (process logs, scan database
etc.)
I Tasks can be used in conjunction with the cron service
Développement logiciel pour le Cloud (TLC)
Background actions in AppEngine
28 / 35
Développement logiciel pour le Cloud (TLC)
Regular web.xml
Requesting periodic execution with cron
We need an additional le:
Développement logiciel pour le Cloud (TLC)
Background actions in AppEngine
30 / 35
Task queues
AppEngine allows users to dene
Développement logiciel pour le Cloud (TLC)
Background actions in AppEngine
31 / 35
Backends
Task queues
Backends are special VMs running continuous jobs
I Add a task to a queue
I For example: a stateful server
I It will be picked up at some point in the future
Développement logiciel pour le Cloud (TLC)
cron.xml
Background actions in AppEngine
32 / 35
Développement logiciel pour le Cloud (TLC)
Background actions in AppEngine
33 / 35
Table of Contents
1
Pros and cons
Pros:
Introduction
I A familiar development environment
2
I The great SDK + local server for testing
Developing Java applications in AppEngine
I No scalability worry
I Lots of APIs for common operations
3
I Lots of ways to program background activities
The Data Store
Cons:
4
Background actions in AppEngine
I Only three supported languages (no PHP)
I Customer lock-in if you use any of the fancy APIs
5
I An unfamiliar data storage system
Conclusion
Développement logiciel pour le Cloud (TLC)
I No explicit performance control
Conclusion
34 / 35
Développement logiciel pour le Cloud (TLC)
Conclusion
35 / 35
Téléchargement