Google App Engine学习笔记

Google App Engine

  

哈哈 Vista=Viruses+Intruders+Spyware+Trojans+Adware

Google App Engine and Google Apps

Google App Engine

     ā a platform for building and hosting web application on Google's infrastructure

     āno servers to maintain: just upload application and it's ready to serve users

Google Apps

     āgives everyone at your organization a custom email address.

     ā tools for word processing spreadsheets and presentations

     ā a shared calendaring system and acess to a flexible intranet system

     ā Standalone security and compliance services

 GAE Features

   āDynamic web serving with full support for cmmon web technologies

   āPersistent storage with queries,sorting and transactions(交易、交流、业务)

   āAutomatic scaling and load balancing

   āAPIs for authenticating(认证) users and sending email using Google Account

   āA fully featured local development environment that simulates Google App Engine on  developer's  computer

The Data Store

   āDistributed data storage service

   āFeatures a query engine and supports transacions including optimistic(乐观、优化、开放式) locking and rollback

   āThe distributed datastore grows with the data

   āApp Engine datastore is not a traditonal relational database,queries are specified using a SQL-like query   language called GQL

GAE Terms of Service-Partial

   āMust provide legally adequate privacy notice and protection for those users.

   āNothing in the Terms  gives you a right to use any of Google's trade names,and other brand features.

GAE Application Environment

     Sandbox:

   āThe sandbox isolates your application in its own secure,reliable environment.

     Python Runtime Environment:

   āPython version 2.5.2 with the Python standard library

   āPython APIs for the datastore,Google Accouts,URL fetch and email services.

   āthe Django web application framework version 0.96.1

GAE Project

   āA project requires at least one Python program and YAML file that tells the hosting web sever how to run and present your application in respoonse to user requests.

   āYAML(YAML Ain't a Markup Language) is a cross-language. human-friendly. data-serialization language used for configuration files.persistence and network messaging.

   āYAML is easier to read by humans and consumes fewer runtime resources than XML

GAE Limitations

   āAn application can only access other computers on the Internet through the provide URL fetch and email sevices and APIs.

   āOther computers can only connect to the application by making HTTP(or HTTPS)requests on the standard ports.

   āAn application cannot write to the file system.

   āAn app can read files,but only files uploaded with the application code.

   āThe app must use the App Engine data store for all data that persists between requests.
   āApplication code only runs in response to a web request.

   āMust return response data within a few seconds.

   āA request handler cannot spawn a sub-process or execute code after the response has been sent.

 Inline HTML vs Templates

   āTemplates are used for separating the pressentation aspects of the application from its business logic.The template engine combines data provided by the application with one or more templates to produce a coherent view of the data.Use WSGI-compatible templating engines(e.g. Django template)int applications. The form handling and user output are quite simple.so using the mainForm() and a simple string replcace() call for the output is acceptable.

GData

   āThe Google Data API(GData) provides a simple protocol for exchanging data between web applications over the RSS or Atom formats. GData is implemented through the Representational State Transfer(REST) protocol open to any application or device that can use HTTP1.1 and its basic API.

   āGData provides a general model for feeds,queries and results.

   āGAE applications can use the GData API for interacting with other Google properties such as these:

       Authentication(认证)

       Google Base

       Calendar

       Documents

       Picasa Web Albums

       YouTube

 OO,relational DB,and Datastore

OBJECT ORIENTED RELATIONAL DATABASE DATASTORE

Class

Table

Kind

Object

Record

Entity

Attribute

Colum

Property

 Query vs. GqlQuery

   āThe Datastore API provides fine-grained(细致的) data manipulation(处理) through the Query and GqlQuery classes.

    āThe Query class provides a Datastroe API for preparing queries based on application-defined entities.

   āGqlQuery is the lowest-level querying API for the Datastore.It uses the App Engine GQL language, and it's limited to efficient data searches and retrieval operations(get() fetch() count() etc.)

 Memcache API

āscenario(梗概):Multiple calls across multiple servers

āMemcache is a services that provides a key-value caching mechanism for efficient in-memory data retrieval(找回 检索 重获) across multiple instances of an GAE application. The Memcache API enables:

         -A reduction in the number of Datastore queries.

         -A reduction in the Datastore quota usage for popular pages.

         -Caching of expensive query results.

         -Implementation(工具 执行) of transient(短暂 暂时) counters

āUsing Mememcache for Session Data

         -Since all sesion activity depends on the owner every usage of any persisted data results in a query.

         -Executing queries on every page interaction is inefficient over the application lifetime.

posted on 2009-12-21 14:39    阅读(430)  评论(0编辑  收藏  举报

导航