SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Akshay Mathur
@akshaymathu
Ground Rules
• Disturb Everyone
– Not by phone rings
– Not by local talks
– By more information
and questions

@akshaymathu

2
Let’s Know Each Other
•
•
•
•
•

Do you code?
OS?
Language?
Used GAE?
Why are you attending?

@akshaymathu

3
Akshay Mathur
• Founding Team Member of
– ShopSocially (Enabling “social” for retailers)
– AirTight Neworks (Global leader of WIPS)

• 15+ years in IT industry
– Currently Principal Architect at ShopSocially
– Mostly worked with Startups
• From Conceptualization to Stabilization
• At different functions i.e. development, testing, release
• With multiple technologies

@akshaymathu

4
What shall we learn
• Why GAE (Google App Engine)?
• General advantages of
– IaaS (Infrastructure as a Service)
– PaaS (Platform as a Service)

• Using GAE SDK
– Available Services from Google

• Filling the Gap
– Including third party libraries
– Creating MVC structure

• Available boilerplate code for quick start
@akshaymathu

5
Why GAE
• Application PaaS maintained by Google
– Same platform that powers Google Applications

• Familiar technologies
– Python, PHP, Java, Go

• Readymade additional services
– Storage, Email, Chat, Task queue etc.

• No (or very low) initial cost
– Free quotas
@akshaymathu

6
@akshaymathu

7
IaaS
• Move your local/data center servers to cloud
– Don’t worry about hardware
– Scale up/down as needed

• Simplified logistics for IT admins
• Pay only for used infrastructure
• Custom hardware is not available
@akshaymathu

8
PaaS: Advantages
• Move your application environment on cloud
– Focus only on your application
– Don’t worry for upgrades
– Easy to scale
– Easy to administer

• Get all benefits of IaaS
• Control in developers’ hand

@akshaymathu

9
@akshaymathu

10
PaaS: Limitations
• No control over machines
– No access to file system
– No ssh

• No native software installation
– Use only the provided software
– Upgrade with the provider

• Limitation on usage of network stack
– No sniffing of traffic
– Limited use of ports
@akshaymathu

11
Getting Started
Hello world!
Why Python
• Because we love it 
• GAE says:

@akshaymathu

13
Getting Started
•
•
•
•
•
•

Install Python 
Download and install GAE SDK
Configure app.yaml
Write code
Test locally as GAE app
Deploy

@akshaymathu

14
Runtime configuration: app.yaml

@akshaymathu

15
Code: main.py

@akshaymathu

16
Deploy

@akshaymathu

17
@akshaymathu

18
Gearing up for Bigger App
Creating the basic Structure
Included Libraries
Webapp2, Django, Ssl, PIL, Pycrypto,
Setuptools, Webob, Yaml, MySQLdb
Endpoints: Libraries for building APIs in an App Engine application.
Jinja2: A modern and designer friendly templating language for Python.
Lxml: A Pythonic binding for the C libraries libxml2 and libxslt.
Markupsafe: A XML/HTML/XHTML markup safe string for Python.
Matplotlib: A 2D plotting library which produces publication-quality figures.
Numpy: A general-purpose library for array-processing.
Protorpc: A framework for implementing HTTP-based remote procedure call (RPC)
services.

PyAMF: A library that provides (AMF) Action Message Format functionality.
@akshaymathu

20
Available Services

@akshaymathu

21
Data Storage
• Datastore
– A schemaless object datastore providing robust, scalable storage
for your web application, a rich data modeling API, and a SQLlike query language called GQL.

• Blobstore
– Allows your application to serve large data objects, such as
video or image files, that are too large for storage in the
Datastore service.

• Memcache
– A distributed, in-memory data cache that can be used to greatly
improve application performance.

• Logs
– Provides programmatic access to application and request logs
from within your application.
@akshaymathu

22
Communications
• Channel
– Creates a persistent connection between your application and
Google servers, so you can send messages to JavaScript clients
in real time without "polling."

• Mail
– Sends email messages on behalf of administrators and users
with Google Accounts, and receives mail at various addresses.

• URL Fetch
– Uses Google's networking infrastructure to efficiently issue
HTTP and HTTPS requests to URLs on the web.

• XMPP
– Enables an application to send and receive chat messages to
and from any XMPP-compatible chat messaging service.

@akshaymathu

23
Process Management
• Task Queue
– Allows applications to perform work outside of a
user request, and organize that work into small,
discrete units, called "tasks," to be executed later.

• Scheduled Tasks
– Allows applications to configure regularly
scheduled tasks that operate at defined times or
regular intervals.

@akshaymathu

24
Computation
• Backends
– Instances of your application that are exempt from
request deadlines and have access to more
memory and CPU resources.

• Images
– Manipulates, combines, and enhances images,
converts images between formats, and queries
image metadata such as height and frequency of
colors.
@akshaymathu

25
App configuration and management
•

App Identity
–

•

Capabilities
–

•

Makes it easy to compartmentalize your data to serve many client organizations from a single instance of
your application.

Traffic Splitting
–

•

Lets external applications transparently access App Engine services. For example, you can use Remote API to
access a production datastore from an app running on your local machine.

Multitenancy
–

•

Allows applications to be served via both HTTPS and HTTP via a custom domain instead of an appspot.com
address.

Remote
–

•

Provides detection of outages and scheduled maintenance for specific APIs and services, so that your
application may bypass them or inform your users.

SSL for Custom Domains
–

•

Gives code access to the application identity; provides framework to assert this identity over OAuth.

Allows you to roll out features for your app slowly over a period of time, and do A/B Testing. Traffic Splitting
works by splitting incoming requests to different versions of your app.

Users
–

Allows applications to sign in users with Google Accounts or OpenID, and address these users with unique
identifiers.

@akshaymathu

26
Third-party Services
• SendGrid (Email)
– Use SendGrid's library to send emails from your
app and you can see statistics on opens, clicks,
unsubscribes, spam reports and more.

• Twilio (SMS/Voice)
– Enables your application to make and receive
phone calls, send and receive text messages, and
make VoIP calls from any phone, tablet, or
browser.
@akshaymathu

27
Preview Features
• Google Cloud Endpoints
– Enables automatic generation of APIs, making it easier to create a web
backend for web clients and mobile clients such as Android or Apple's iOS.

• Google Cloud SQL
– A fully-managed web service that allows you to create, configure, and use
relational databases that live in Google's cloud.

• Google Cloud Storage Client Library
– Lets your application read files from and write files to buckets in Google Cloud
Storage, with with internal error handling and retry logic.

• Modules
– Lets developers factor large applications into logical components that can
share stateful services and communicate in a secure fashion.

• Sockets
– Enables support for outbound sockets using the language-specific, built-in
libraries.

@akshaymathu

28
Experimental Features
•

MapReduce
– An optimized adaptation of the MapReduce computing model for efficient distributed
computing over large data sets.

•

OAuth
– Using Google Accounts and the OAuth API, any App Engine application can be an OAuth
consumer.

•

OpenID
– An open technology used for authenticating users across various web services.

•

PageSpeed
– A family of tools that automatically optimizes the performance of your application.

•

Task Queue REST API
– Enables the use of an App Engine task queue over REST.

•

Task Queue Tagging
– Leases up to a specified number of tasks with the same tag from the queue for a
specified period of time.
@akshaymathu

29
Search
• Search
– Allows your application to perform Google-like
searches over structured data such as: plain text,
HTML, atom, numbers, dates, and geographic
locations.

• Prospective Search
– A querying service that allows your application to
match search queries against real-time data
streams.
@akshaymathu

30
Filling the Gap
• Including other libraries
– Place them within your app
– Only pure Python libs can be used

• Creating MVC structure
– Create your own directory structure
– Adjust path for supporting it

@akshaymathu

31
MVC Structure

@akshaymathu

32
New Code: main.py

@akshaymathu

33
Global Configuration: config.py

@akshaymathu

34
Route List

@akshaymathu

35
Controller

@akshaymathu

36
Base Controller

@akshaymathu

37
Third Party Libs

@akshaymathu

38
Static Files

@akshaymathu

39
@akshaymathu

40
Dive Deeper
Get the app working
Scheduled Tasks: cron.yaml

@akshaymathu

42
Datastore
• NoSQL database is available in free quota
– SQL database (Google Cloud SQL) is also available

@akshaymathu

43
Data Manipulation
• Functions
– .get_by_id()
– .all()

– .put()
– db.delete()

• GQL
– .gql()
• People.gql("where email_addr = :1 and passwd
= :2", username, get_password_hash(passwd))

– gql_query()
• gql_query(”select * from people where
email_addr = :1 and passwd = :2", username,
get_password_hash(passwd))
@akshaymathu

44
Task Queue

@akshaymathu

45
Sending Emails
• Gmail is available as mail service by default
– Sendgrid can also be used

@akshaymathu

46
Using Others’ Web API
• Urlfetch can be used for accessing external
web urls

@akshaymathu

47
Sockets
•
•
•
•

Only for paid apps
Works exactly same as standard socket library
Inbound sockets are not allowed
Outbound sockets can be used with
restrictions

@akshaymathu

48
Google’s Login
from google.appengine.api import users

user = users.get_current_user()
if user:
user.nickname()
users.create_logout_url('/')))
else:
users.create_login_url('/'))

@akshaymathu

49
Working with Images
• Images can be stored in database in blob fields
• Available transforms
– Resize, Crop
– Rotate, Flip horizontal /vertical
– Enhance (Im feeling lucky)

• Formats Conversions
– from: JPEG, PNG, WEBP, GIF, BMP, TIFF and ICO
– to: JPEG, WEBP and PNG

@akshaymathu

50
Image Manipulation
from google.appengine.api import images
img = images.Image(blob_key=blob_key)
img.resize(width=80, height=100)
img.im_feeling_lucky()
thumbnail = img.execute_transforms(
output_encoding=images.JPEG)
@akshaymathu

51
Caching

@akshaymathu

52
@akshaymathu

53
Available Code on GitHub
• Implementation of login system
– mathurakshay/gae-social-login
• https://github.com/mathurakshay/gae-social-

• Just the MVC structure
– droot/gae-boilerplate
• https://github.com/droot/gae-boilerplate

@akshaymathu

54
Summary
• GAE is good readymade platform
– For trying out things
– For your side project

• Many services are readily available
• Starts with no (or very low) upfront cost
• Think thrice before you start big business on
GAE

@akshaymathu

55
Thanks

@akshaymathu
@akshaymathu

56

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

What is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokWhat is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 Depok
 
Serverless Big Data Architecture on Google Cloud Platform at Credit OK
Serverless Big Data Architecture on Google Cloud Platform at Credit OKServerless Big Data Architecture on Google Cloud Platform at Credit OK
Serverless Big Data Architecture on Google Cloud Platform at Credit OK
 
Hacking google cloud run
Hacking google cloud runHacking google cloud run
Hacking google cloud run
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special Training
 
Google Cloud Dataflow meets TensorFlow
Google Cloud Dataflow meets TensorFlowGoogle Cloud Dataflow meets TensorFlow
Google Cloud Dataflow meets TensorFlow
 
Google App Engine Introduction
Google App Engine IntroductionGoogle App Engine Introduction
Google App Engine Introduction
 
Intro to the Google Cloud for Developers
Intro to the Google Cloud for DevelopersIntro to the Google Cloud for Developers
Intro to the Google Cloud for Developers
 
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試
 
Understanding cloud with Google Cloud Platform
Understanding cloud with Google Cloud PlatformUnderstanding cloud with Google Cloud Platform
Understanding cloud with Google Cloud Platform
 
Google compute engine - overview
Google compute engine - overviewGoogle compute engine - overview
Google compute engine - overview
 
I've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveI've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you have
 
Creating autocomplete with elastic search on google cloud
Creating autocomplete with elastic search on google cloudCreating autocomplete with elastic search on google cloud
Creating autocomplete with elastic search on google cloud
 
TIAD : Automate everything with Google Cloud
TIAD : Automate everything with Google CloudTIAD : Automate everything with Google Cloud
TIAD : Automate everything with Google Cloud
 
Orchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWSOrchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWS
 
Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016
Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016
Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016
 
Serverless with Google Cloud Functions
Serverless with Google Cloud FunctionsServerless with Google Cloud Functions
Serverless with Google Cloud Functions
 
Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3
 
Google Cloud: Data Analysis and Machine Learningn Technologies
Google Cloud: Data Analysis and Machine Learningn Technologies Google Cloud: Data Analysis and Machine Learningn Technologies
Google Cloud: Data Analysis and Machine Learningn Technologies
 
Google Cloud Dataflow
Google Cloud DataflowGoogle Cloud Dataflow
Google Cloud Dataflow
 
Fluent 2018: Measuring What Matters
Fluent 2018: Measuring What MattersFluent 2018: Measuring What Matters
Fluent 2018: Measuring What Matters
 

Andere mochten auch

Gae icc fall2011
Gae icc fall2011Gae icc fall2011
Gae icc fall2011
Juan Gomez
 

Andere mochten auch (20)

Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-python
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Google App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: BasicGoogle App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: Basic
 
Zope 3 at Google App Engine
Zope 3 at Google App EngineZope 3 at Google App Engine
Zope 3 at Google App Engine
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with Javascript
 
Cloud Computing Bootcamp On The Google App Engine v1.2.1
Cloud Computing Bootcamp On The Google App Engine v1.2.1Cloud Computing Bootcamp On The Google App Engine v1.2.1
Cloud Computing Bootcamp On The Google App Engine v1.2.1
 
Gae icc fall2011
Gae icc fall2011Gae icc fall2011
Gae icc fall2011
 
App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munich
 
App Engine
App EngineApp Engine
App Engine
 
Introduccion app engine con python
Introduccion app engine con pythonIntroduccion app engine con python
Introduccion app engine con python
 
App Engine for Python Developers
App Engine for Python DevelopersApp Engine for Python Developers
App Engine for Python Developers
 
Google app engine python
Google app engine   pythonGoogle app engine   python
Google app engine python
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Object Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptObject Oriented Programing in JavaScript
Object Oriented Programing in JavaScript
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
 
Google datastore & search api
Google datastore & search apiGoogle datastore & search api
Google datastore & search api
 
Google Cloud Platform. Google App Engine
Google Cloud Platform. Google App Engine Google Cloud Platform. Google App Engine
Google Cloud Platform. Google App Engine
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 

Ähnlich wie Using Google App Engine Python

App_Engine_PPT..........................
App_Engine_PPT..........................App_Engine_PPT..........................
App_Engine_PPT..........................
HassamShahid2
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
saivvit
 
Techniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudTechniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloud
Akshay Mathur
 

Ähnlich wie Using Google App Engine Python (20)

Power Your Mobile Applications On The Cloud [IndicThreads Mobile Application ...
Power Your Mobile Applications On The Cloud [IndicThreads Mobile Application ...Power Your Mobile Applications On The Cloud [IndicThreads Mobile Application ...
Power Your Mobile Applications On The Cloud [IndicThreads Mobile Application ...
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
App_Engine_PPT..........................
App_Engine_PPT..........................App_Engine_PPT..........................
App_Engine_PPT..........................
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Gcp intro-20160721
Gcp intro-20160721Gcp intro-20160721
Gcp intro-20160721
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Techniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudTechniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloud
 
Demistifying serverless on aws
Demistifying serverless on awsDemistifying serverless on aws
Demistifying serverless on aws
 
Google Cloud Platform - Introduction & Certification Path 2018
Google Cloud Platform - Introduction & Certification Path 2018Google Cloud Platform - Introduction & Certification Path 2018
Google Cloud Platform - Introduction & Certification Path 2018
 
2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix
 
Sai_Resume
Sai_ResumeSai_Resume
Sai_Resume
 
Splunk Developer Platform
Splunk Developer PlatformSplunk Developer Platform
Splunk Developer Platform
 
Google apps engine
Google apps engineGoogle apps engine
Google apps engine
 
2015-12-02 - WebCamp - Microsoft Azure Logic Apps
2015-12-02 - WebCamp - Microsoft Azure Logic Apps2015-12-02 - WebCamp - Microsoft Azure Logic Apps
2015-12-02 - WebCamp - Microsoft Azure Logic Apps
 
Oow2016 review--paas-microservices-
Oow2016 review--paas-microservices-Oow2016 review--paas-microservices-
Oow2016 review--paas-microservices-
 
Google apps engine
Google apps engineGoogle apps engine
Google apps engine
 
Tech UG - Newcastle 09-17 - logic apps
Tech UG - Newcastle 09-17 -   logic appsTech UG - Newcastle 09-17 -   logic apps
Tech UG - Newcastle 09-17 - logic apps
 
Optimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best PracticesOptimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best Practices
 

Mehr von Akshay Mathur

Testing Single Page Webapp
Testing Single Page WebappTesting Single Page Webapp
Testing Single Page Webapp
Akshay Mathur
 

Mehr von Akshay Mathur (17)

Documentation with Sphinx
Documentation with SphinxDocumentation with Sphinx
Documentation with Sphinx
 
Kubernetes Journey of a Large FinTech
Kubernetes Journey of a Large FinTechKubernetes Journey of a Large FinTech
Kubernetes Journey of a Large FinTech
 
Security and Observability of Application Traffic in Kubernetes
Security and Observability of Application Traffic in KubernetesSecurity and Observability of Application Traffic in Kubernetes
Security and Observability of Application Traffic in Kubernetes
 
Enhanced Security and Visibility for Microservices Applications
Enhanced Security and Visibility for Microservices ApplicationsEnhanced Security and Visibility for Microservices Applications
Enhanced Security and Visibility for Microservices Applications
 
Considerations for East-West Traffic Security and Analytics for Kubernetes En...
Considerations for East-West Traffic Security and Analytics for Kubernetes En...Considerations for East-West Traffic Security and Analytics for Kubernetes En...
Considerations for East-West Traffic Security and Analytics for Kubernetes En...
 
Kubernetes as Orchestrator for A10 Lightning Controller
Kubernetes as Orchestrator for A10 Lightning ControllerKubernetes as Orchestrator for A10 Lightning Controller
Kubernetes as Orchestrator for A10 Lightning Controller
 
Cloud Bursting with A10 Lightning ADS
Cloud Bursting with A10 Lightning ADSCloud Bursting with A10 Lightning ADS
Cloud Bursting with A10 Lightning ADS
 
Shared Security Responsibility Model of AWS
Shared Security Responsibility Model of AWSShared Security Responsibility Model of AWS
Shared Security Responsibility Model of AWS
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
 
Releasing Software Without Testing Team
Releasing Software Without Testing TeamReleasing Software Without Testing Team
Releasing Software Without Testing Team
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Creating Single Page Web App using Backbone JS
Creating Single Page Web App using Backbone JSCreating Single Page Web App using Backbone JS
Creating Single Page Web App using Backbone JS
 
Getting Started with Web
Getting Started with WebGetting Started with Web
Getting Started with Web
 
Working with GIT
Working with GITWorking with GIT
Working with GIT
 
Testing Single Page Webapp
Testing Single Page WebappTesting Single Page Webapp
Testing Single Page Webapp
 
Mongo db
Mongo dbMongo db
Mongo db
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Using Google App Engine Python

  • 2. Ground Rules • Disturb Everyone – Not by phone rings – Not by local talks – By more information and questions @akshaymathu 2
  • 3. Let’s Know Each Other • • • • • Do you code? OS? Language? Used GAE? Why are you attending? @akshaymathu 3
  • 4. Akshay Mathur • Founding Team Member of – ShopSocially (Enabling “social” for retailers) – AirTight Neworks (Global leader of WIPS) • 15+ years in IT industry – Currently Principal Architect at ShopSocially – Mostly worked with Startups • From Conceptualization to Stabilization • At different functions i.e. development, testing, release • With multiple technologies @akshaymathu 4
  • 5. What shall we learn • Why GAE (Google App Engine)? • General advantages of – IaaS (Infrastructure as a Service) – PaaS (Platform as a Service) • Using GAE SDK – Available Services from Google • Filling the Gap – Including third party libraries – Creating MVC structure • Available boilerplate code for quick start @akshaymathu 5
  • 6. Why GAE • Application PaaS maintained by Google – Same platform that powers Google Applications • Familiar technologies – Python, PHP, Java, Go • Readymade additional services – Storage, Email, Chat, Task queue etc. • No (or very low) initial cost – Free quotas @akshaymathu 6
  • 8. IaaS • Move your local/data center servers to cloud – Don’t worry about hardware – Scale up/down as needed • Simplified logistics for IT admins • Pay only for used infrastructure • Custom hardware is not available @akshaymathu 8
  • 9. PaaS: Advantages • Move your application environment on cloud – Focus only on your application – Don’t worry for upgrades – Easy to scale – Easy to administer • Get all benefits of IaaS • Control in developers’ hand @akshaymathu 9
  • 11. PaaS: Limitations • No control over machines – No access to file system – No ssh • No native software installation – Use only the provided software – Upgrade with the provider • Limitation on usage of network stack – No sniffing of traffic – Limited use of ports @akshaymathu 11
  • 13. Why Python • Because we love it  • GAE says: @akshaymathu 13
  • 14. Getting Started • • • • • • Install Python  Download and install GAE SDK Configure app.yaml Write code Test locally as GAE app Deploy @akshaymathu 14
  • 19. Gearing up for Bigger App Creating the basic Structure
  • 20. Included Libraries Webapp2, Django, Ssl, PIL, Pycrypto, Setuptools, Webob, Yaml, MySQLdb Endpoints: Libraries for building APIs in an App Engine application. Jinja2: A modern and designer friendly templating language for Python. Lxml: A Pythonic binding for the C libraries libxml2 and libxslt. Markupsafe: A XML/HTML/XHTML markup safe string for Python. Matplotlib: A 2D plotting library which produces publication-quality figures. Numpy: A general-purpose library for array-processing. Protorpc: A framework for implementing HTTP-based remote procedure call (RPC) services. PyAMF: A library that provides (AMF) Action Message Format functionality. @akshaymathu 20
  • 22. Data Storage • Datastore – A schemaless object datastore providing robust, scalable storage for your web application, a rich data modeling API, and a SQLlike query language called GQL. • Blobstore – Allows your application to serve large data objects, such as video or image files, that are too large for storage in the Datastore service. • Memcache – A distributed, in-memory data cache that can be used to greatly improve application performance. • Logs – Provides programmatic access to application and request logs from within your application. @akshaymathu 22
  • 23. Communications • Channel – Creates a persistent connection between your application and Google servers, so you can send messages to JavaScript clients in real time without "polling." • Mail – Sends email messages on behalf of administrators and users with Google Accounts, and receives mail at various addresses. • URL Fetch – Uses Google's networking infrastructure to efficiently issue HTTP and HTTPS requests to URLs on the web. • XMPP – Enables an application to send and receive chat messages to and from any XMPP-compatible chat messaging service. @akshaymathu 23
  • 24. Process Management • Task Queue – Allows applications to perform work outside of a user request, and organize that work into small, discrete units, called "tasks," to be executed later. • Scheduled Tasks – Allows applications to configure regularly scheduled tasks that operate at defined times or regular intervals. @akshaymathu 24
  • 25. Computation • Backends – Instances of your application that are exempt from request deadlines and have access to more memory and CPU resources. • Images – Manipulates, combines, and enhances images, converts images between formats, and queries image metadata such as height and frequency of colors. @akshaymathu 25
  • 26. App configuration and management • App Identity – • Capabilities – • Makes it easy to compartmentalize your data to serve many client organizations from a single instance of your application. Traffic Splitting – • Lets external applications transparently access App Engine services. For example, you can use Remote API to access a production datastore from an app running on your local machine. Multitenancy – • Allows applications to be served via both HTTPS and HTTP via a custom domain instead of an appspot.com address. Remote – • Provides detection of outages and scheduled maintenance for specific APIs and services, so that your application may bypass them or inform your users. SSL for Custom Domains – • Gives code access to the application identity; provides framework to assert this identity over OAuth. Allows you to roll out features for your app slowly over a period of time, and do A/B Testing. Traffic Splitting works by splitting incoming requests to different versions of your app. Users – Allows applications to sign in users with Google Accounts or OpenID, and address these users with unique identifiers. @akshaymathu 26
  • 27. Third-party Services • SendGrid (Email) – Use SendGrid's library to send emails from your app and you can see statistics on opens, clicks, unsubscribes, spam reports and more. • Twilio (SMS/Voice) – Enables your application to make and receive phone calls, send and receive text messages, and make VoIP calls from any phone, tablet, or browser. @akshaymathu 27
  • 28. Preview Features • Google Cloud Endpoints – Enables automatic generation of APIs, making it easier to create a web backend for web clients and mobile clients such as Android or Apple's iOS. • Google Cloud SQL – A fully-managed web service that allows you to create, configure, and use relational databases that live in Google's cloud. • Google Cloud Storage Client Library – Lets your application read files from and write files to buckets in Google Cloud Storage, with with internal error handling and retry logic. • Modules – Lets developers factor large applications into logical components that can share stateful services and communicate in a secure fashion. • Sockets – Enables support for outbound sockets using the language-specific, built-in libraries. @akshaymathu 28
  • 29. Experimental Features • MapReduce – An optimized adaptation of the MapReduce computing model for efficient distributed computing over large data sets. • OAuth – Using Google Accounts and the OAuth API, any App Engine application can be an OAuth consumer. • OpenID – An open technology used for authenticating users across various web services. • PageSpeed – A family of tools that automatically optimizes the performance of your application. • Task Queue REST API – Enables the use of an App Engine task queue over REST. • Task Queue Tagging – Leases up to a specified number of tasks with the same tag from the queue for a specified period of time. @akshaymathu 29
  • 30. Search • Search – Allows your application to perform Google-like searches over structured data such as: plain text, HTML, atom, numbers, dates, and geographic locations. • Prospective Search – A querying service that allows your application to match search queries against real-time data streams. @akshaymathu 30
  • 31. Filling the Gap • Including other libraries – Place them within your app – Only pure Python libs can be used • Creating MVC structure – Create your own directory structure – Adjust path for supporting it @akshaymathu 31
  • 41. Dive Deeper Get the app working
  • 43. Datastore • NoSQL database is available in free quota – SQL database (Google Cloud SQL) is also available @akshaymathu 43
  • 44. Data Manipulation • Functions – .get_by_id() – .all() – .put() – db.delete() • GQL – .gql() • People.gql("where email_addr = :1 and passwd = :2", username, get_password_hash(passwd)) – gql_query() • gql_query(”select * from people where email_addr = :1 and passwd = :2", username, get_password_hash(passwd)) @akshaymathu 44
  • 46. Sending Emails • Gmail is available as mail service by default – Sendgrid can also be used @akshaymathu 46
  • 47. Using Others’ Web API • Urlfetch can be used for accessing external web urls @akshaymathu 47
  • 48. Sockets • • • • Only for paid apps Works exactly same as standard socket library Inbound sockets are not allowed Outbound sockets can be used with restrictions @akshaymathu 48
  • 49. Google’s Login from google.appengine.api import users user = users.get_current_user() if user: user.nickname() users.create_logout_url('/'))) else: users.create_login_url('/')) @akshaymathu 49
  • 50. Working with Images • Images can be stored in database in blob fields • Available transforms – Resize, Crop – Rotate, Flip horizontal /vertical – Enhance (Im feeling lucky) • Formats Conversions – from: JPEG, PNG, WEBP, GIF, BMP, TIFF and ICO – to: JPEG, WEBP and PNG @akshaymathu 50
  • 51. Image Manipulation from google.appengine.api import images img = images.Image(blob_key=blob_key) img.resize(width=80, height=100) img.im_feeling_lucky() thumbnail = img.execute_transforms( output_encoding=images.JPEG) @akshaymathu 51
  • 54. Available Code on GitHub • Implementation of login system – mathurakshay/gae-social-login • https://github.com/mathurakshay/gae-social- • Just the MVC structure – droot/gae-boilerplate • https://github.com/droot/gae-boilerplate @akshaymathu 54
  • 55. Summary • GAE is good readymade platform – For trying out things – For your side project • Many services are readily available • Starts with no (or very low) upfront cost • Think thrice before you start big business on GAE @akshaymathu 55