Lesson 4 : Using the Data store
In our previous lessons we learned:
Today we will learn how to store data on the AppEngine Server to list
it at any time.
Lessons Outlines:-
- Introduction
- Types of Data Store
- Component of Data Store
- Complete our previous application
- Test your application.
1 – Introduction
In General ,
- Storing data in a scalable web application can be tricky.
- A user could be interacting with any of dozens of web servers at a given time
- and the user’s next request could go to a different web server than the one that handled the previous request
With Google App Engine ,
- You don’t have to worry about any of that App Engine’s infrastructure takes care of all of the distribution , replication and load balancing of data behind a simple API
- You get a powerful query engine and transactions as well.
2 - Types
of Data Store
1-
High
Replication datastore ( HRD )
a.
The
default datastore for an application
b.
Data is
replicated across multiple data centers using a system based on the Paxos algorithm.
c.
This
provides the highest level of availability for reads and writes, at the cost of
higher latency on writes due to the propagation of data.
2-
Master/Slave Data Store
a.
Designates one data
center to hold the master copy of all data.
b.
Data written to the
master data center is replicated asynchronously to all other (slave) data
centers.
c.
Since only one data
center is the master for writing at any given time, this option offers strong
consistency for all reads and queries, at the cost of periods of temporary
unavailability during data center issues or planned downtime.
3 - Component of Data Store
1-
The datastore writes
data in objects known as entities.
2-
Each entity has a key that identifies the entity.
3-
Entities can belong to
the same entity group,
which allows you to perform a single transaction with multiple entities.
4-
Entity groups have a parent key that identifies the entire entity
group.
4 - Complete our previous application
follow next steps :
1 - Update Servlet Class to Save our Entity
2 - Update JSP Page to list all Stored Object
As we mentioned
before.to run your applications write (http://localhost:8888/) in your browser to be able to test it.
And now we need
to know where the entities are stored?
The answer is:
check this URL (http://localhost:8888/_ah/admin) you will find your entities and data stored in it.
Now we have
finished our lesson today.
To download the source code
Thanks
1 comments: on "Google App Engine : Using the Data store"
Nice tutorial. I found your blog very useful. keep it up. I also blog on Javarevisited.blogspot.com let me know how do you find it.
Thanks
Javin
Post a Comment