Module-4-Cloud Application Development
Module-4-Cloud Application Development
Development
• Scalability
• Scalability is an important factor that drives the application designers to move to cloud computing environments. Building applications
that can serve millions of users without taking a hit on their performance has always been challenging. With the growth of cloud
computing application designers can provision adequate resources to meet their workload levels.
• Reliability & Availability
• Reliability of a system is defined as the probability that a system will perform the intended functions under stated conditions for a
specified amount of time. Availability is the probability that a system will perform a specified function under given conditions at a
prescribed time.
• Security
• Security is an important design consideration for cloud applications given the outsourced nature of cloud computing environments.
• Maintenance & Upgradation
• To achieve a rapid time-to-market, businesses typically launch their applications with a core set of features ready and then
incrementally add new features as and when they are complete. In such scenarios, it is important to design applications with low
maintenance and upgradation costs.
• Performance
• Applications should be designed while keeping the performance requirements in mind.
• Cloud Component Model is an application design methodology that provides a flexible way
of creating cloud applications in a rapid, convenient and platform independent manner.
• CCM is an architectural approach for cloud applications that is not tied to any specific
programming language or cloud platform.
• Cloud applications designed with CCM approach can have innovative hybrid deployments
in which different components of an application can be deployed on cloud infrastructure
and platforms of different cloud vendors.
• Applications designed using CCM have better portability and interoperability.
• CCM based applications have better scalability by decoupling application components and
providing asynchronous communication mechanisms.
Similarities
SOA CCM
Standardization & SOA advocates principles of CCM is based on reusable
Re-use reuse and well defined components which can be used
relationship between service by multiple cloud applications.
provider and service consumer.
SOA CCM
End points SOA services have small and well-defined set CCM components have very large number of
of endpoints through which many types of endpoints. There is an endpoint for each resource
data can pass. in a component, identified by a URI.
Messaging SOA uses a messaging layer above HTTP by CCM components use HTTP and REST for
using SOAP which provide prohibitive messaging.
constraints to developers.
Security Uses WS-Security , SAML and other CCM components use HTTPS for security.
standards for security
Interfacing SOA uses XML for interfacing. CCM allows resources in components represent
different formats for interfacing (HTML, XML,
JSON, etc.).
Consumption Consuming traditional SOA services in a CCM components and the underlying component
browser is cumbersome. resources are exposed as XML, JSON (and other
formats) over HTTP or REST, thus easy to consume
in the browser.
• Model View Controller (MVC) is a popular software design pattern for web applications.
• Model
• Model manages the data and the behavior of the applications. Model processes events sent by the controller. Model has no information about the views and controllers.
Model responds to the requests for information about its state (from the view) and responds to the instructions to change state (from controller).
• View
• View prepares the interface which is shown to the user. Users interact with the application through views. Views present the information that the model or controller tell
the view to present to the user and also handle user requests and sends them to the controller.
• Controller
• Controller glues the model to the view. Controller processes user requests and updates the model when the user manipulates the view. Controller also updates the view
when the model changes.
• Representational State Transfer (REST) is a set of architectural principles by which you can design
web services and web APIs that focus on a system’s resources and how resource states are
addressed and transferred.
• The REST architectural constraints apply to the components, connectors, and data elements, within
a distributed hypermedia system.
• A RESTful web service is a web API implemented using HTTP and REST principles.
• The REST architectural constraints are as follows:
• Client-Server
• Stateless
• Cacheable
• Layered System
• Uniform Interface
• Code on demand
• Django is an open source web application framework for developing web applications in Python.
• A web application framework in general is a collection of solutions, packages and best practices
that allows development of web applications and dynamic websites.
• Django is based on the Model-Template-View architecture and provides a separation of the data
model from the business rules and the user interface.
• Django provides a unified API to a database backend.
• Thus web applications built with Django can work with different databases without requiring any
code changes.
• With this fiexibility in web application design combined with the powerful capabilities of the Python
language and the Python ecosystem, Django is best suited for cloud applications.
• Django consists of an object-relational mapper, a web templating system and a regular-expression-
based URL dispatcher.
• Model
• The model acts as a definition of some stored data and handles the interactions with the database. In a web
application, the data can be stored in a relational database, non-relational database, an XML file, etc. A Django model is
a Python class that outlines the variables and methods for a particular type of data.
• Template
• In a typical Django web application, the template is simply an HTML page with a few extra placeholders. Django’s
template language can be used to create various forms of text files (XML, email, CSS, Javascript, CSV, etc.)
• View
• The view ties the model to the template. The view is where you write the code that actually generates the web pages.
View determines what data is to be displayed, retrieves the data from the database and passes the data to the
template.
Component Design
• Indentify the building blocks of the application and to be performed by each block
• Group the building blocks based on the functions performed and type of cloud resources required and identify
the application components based on the groupings
• Identify the inputs and outputs of each component
• List the interfaces that each component will expose
• Evaluate the implementation alternatives for each component (design patterns such as MVC, etc.)
Architecture Design
Deployment Design
• Map the application components to specific cloud resources (such as web servers, application servers,
database servers, etc.)
• For applications that use the Platform-as-a-service (PaaS) cloud service model, the architecture and
deployment design steps are not required since the platform takes care of the architecture and deployment.
• Component Design
• In the component design step, the developers have to take into consideration the platform specific features.
• Sandbox Environments
• Applications designed for specific PaaS offerings run in sandbox environments and are allowed to perform only those actions that do
not interfere with the performance of other applications.
• Portability
• Portability is a major constraint for PaaS based applications as it is difficult to move the
• Functionality:
• A cloud-based Image Processing application.
• This application provides online image filtering capability.
• Users can upload image files and choose the filters to apply.
• The selected filters are applied to the image and the processed
image can then be downloaded.
• Component Design
• Web Tier: The web tier for the image processing app has front
ends for image submission and displaying processed images.
• Application Tier: The application tier has components for
processing the image submission requests, processing the
submitted image and processing requests for displaying the Component design for Image Processing App
results.
• Storage Tier: The storage tier comprises of the storage for
processed images.
• Functionality:
• A cloud-based document storage (Cloud Drive) application.
• This application allows users to store documents on a cloud-
based storage.
• Component Design
• Web Tier: The web tier for the Cloud Drive app has front ends for
uploading files, viewing/deleting files and user profile.
• Application Tier: The application tier has components for
processing requests for uploading files, processing requests for
viewing/deleting files and the component that handles the
registration, profile and login functions.
• Database Tier: The database tier comprises of a user credentials
Component design for Cloud Drive App
database.
• Storage Tier: The storage tier comprises of the storage for files.
• Functionality:
• A cloud-based Social Media Analytics application.
• This application collects the social media feeds (Twitter
tweets) on a specified keyword in real time and analyzes the
sentiments of the tweets and provides aggregate results.
• Component Design
• Web Tier: The web tier has a front end for displaying results.
• Application Tier: The application tier has a listener
component that collects social media feeds, a consumer
component that analyzes tweets and a component for
rendering the results in the dashboard.
• Database Tier: A MongoDB database is used for the database
tier and a cloud storage is used for the storage tier. Component design for Social Media Analytics App
• Storage Tier: The storage tier comprises of the storage for
files.
• Serverless Computing is an execution model for cloud computing environments where the
cloud provider executes a piece of code (a function) by dynamically allocating resources.
• While in serverless computing (also referred to as Serverless in short) servers (such as
physical servers, virtual machines or containers) are still required for execution of code, the
difference from server-based computing is that in serverless a layer of abstraction is added on
top of cloud infrastructure such that the application developers do not need to provision and
manage the underlying infrastructure required for execution of code.
• Unlike in server-based computing, where servers have to be provisioned and run continuously
to run the applications, in serverless computing, there is no need to provision the resources.
• The cloud provider manages the provisioning and scaling of the infrastructure required to run
the functions.
• Cloud providers charge for the amount of resources used to run the code which makes
serverless computing much more cost effective than server-based computing where servers
have to run continuously.
Example of a multi-tier web application implemented with the serverless computing model.
1. Amazon Route 53 is a Domain Name System (DNS) service that translates domain names into IP
addresses
2. Amazon Cognito is a cloud-based service offered by Amazon Web Services (AWS) that provides user
sign-up, sign-in, and access control for web and mobile applications.
3. Amazon DynamoDB is a NoSQL database service from Amazon Web Services (AWS) that supports
key-value and document data structures
4. AWS Lambda is a serverless computing service that lets you run code in response to events
5. API Gateway is a management tool that acts as an interface between users and microservices.
The Amazon API Gateway is an AWS service that allows users to create, publish, secure, maintain and
monitor APIs at any scale
6. Amazon Simple Storage Service (S3) is a web service that allows users to store and retrieve data
online.
© 2019 Arshdeep Bahga & Vijay Madisetti
Pros and Cons of Serverless
• Pros:
• Low Operational Cost
• Low Maintenance
• Scalability
• Availability & Fault Tolerance
• Cons:
• No control over the infrastructure
• Time limits
• Vendor lock-in
• Not suitable for all use cases
Amazon Kinesis is a service from Amazon Web Services (AWS) that lets users process and analyze large
amounts of data in real time. It can be used to build applications that consume and process data from multiple
sources at once
© 2019 Arshdeep Bahga & Vijay Madisetti
Serverless Use Case - Real-time File Processing
Amazon Kinesis is a service from Amazon Web Services (AWS) that lets users process and analyze large
amounts of data in real time. It can be used to build applications that consume and process data from multiple
sources at once
© 2019 Arshdeep Bahga & Vijay Madisetti
Serverless Use Case - Mobile Application Backends
Amazon Simple Notification Service (SNS) is a cloud service that sends messages between systems and
applications
© 2019 Arshdeep Bahga & Vijay Madisetti
Serverless Use Case - Extract, Transform, Load (ETL)
• Messaging queues can be used between the data producers and data consumers for asynchronous
processing or load leveling.
• Queues are useful for push-pull messaging where the producers push data to the queues, and the
consumers pull the data from the queues.
• Command Pattern is useful when you want to decouple a sender or client who invokes a
certain operation from a receiver or worker who performs the operation.
• Concurrent execution refers to the number of executions of the functions which are happening at
the same time.
• Cloud providers set limits on concurrent executions.
• In AWS Lambda, you can have at the most 1000 concurrent executions across all the functions in
your account, which is the account concurrency limit.
• You can also optionally set a function concurrency limit and reserve concurrency for a function out
of the unreserved account concurrency limit.
• For event sources that aren’t poll-based, you can use estimate the number of concurrent
invocations of your Lambda functions using the formula: Events/Requests per second × Function
Duration.
• For poll-based event sources that are stream based (Kinesis or DynamoDB streams) the
concurrency is equal to the number of active shards.
• For poll-based event sources that are not stream based (SQS queues), each message batch can
be considered a single concurrent unit.
• Cloud providers set a timeout limit under which a function execution must complete.
• For example, AWS Lambda has a timeout limit of 5 minutes.
• If the function takes a longer time to execute than the timeout limit, the function execution
is terminated.
• This makes the serverless computing model more suitable for real-time or short running
operations rather than long-running batch operations.
• Cloud providers typically use containers for executing the functions in their serverless
offerings.
• A container helps in isolating the execution of a function from other functions.
• When a function is invoked for the first time (or after a long time), a container is created,
the execution environment is initialized, and the function code is loaded.
• The container is reused for subsequent invocations of the same function that happen
within a certain period.
• However, as a developer, you should not assume that a container is reused.
• The functions should be designed to be stateless, and any application state should be
stored in external resources such as a database, cloud storage, or cache.
• When a function has not been executed for a long time or is being executed for the first
time, a new container has to be created, and the execution environment has to be
initialized. This is called a cold start.
• Cold start can result in a higher latency as a new container has to be initialized.
• The cloud provider may reuse the container for subsequent invocations of the same
functions within a short period.
• In this case, the function is said to be warm and takes much less time to execute than a
cold start.
• To reduce the execution time of functions and avoid cold starts, you can keep the
functions warm by invoking them periodically.