Sunteți pe pagina 1din 133

CSI ZG524 -

Middleware Technologies
BITS Pilani Ravi Kiran MALLIDI
Pilani|Dubai|Goa|Hyderabad Enterprise Architect

1
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Comprehensive Exam - Preparation


CSI ZG524 Middleware Technologies 2
Raise of Integrations

Raise of
Machines
Raise of (REST, Cloud
Services (SOA, Services, MSA,
SOAP, REST, Serverless
Raise of ESB, BPM) Technologies)
Middleware’s
(MOM, EAI)
Raise Of
Frameworks
(RPC/RMI,
CORBA,
DCOM, EJB’s)
Raise Of
The Web
(TCP/IP,
IPC)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Middleware Concepts
CSI ZG524 Middleware Technologies 4
Types Middleware
Here are some of the most widely used types of middleware

• Remote Procedure Call (RPC) middleware provides a protocol that allows a program to
request a service from another program located on another computer or network.
• Object or ORB (Object Request Broker) middleware enables software components or
objects to communicate and interact with a programs, such as containers, across
distributed systems.
• Messaging (JMS) middleware facilitates communications between distributed
applications and services
• Data or database middleware enables direct access to, and interaction with, databases;
it typically includes SQL database software
• Transaction or transactional middleware ensures transactions move from one phase
to the next via transaction process monitoring.
• Content-centric middleware allows client-side requests for specific content and
abstracts and delivers it; it's similar to publish / subscribe middleware like Apache
Kafka.
• Embedded middleware facilitates communication and integration between embedded
apps and real-time operating systems 5

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

EAI Patterns
6
EAI Patterns
Bobby Woolf and Addison-Wesley documented a pattern language consisting of 65
integration patterns to establish a technology-independent vocabulary and a visual notation
to design and document integration solutions, ranging from
• connecting applications to a messaging system
• routing messages to the proper destination and
• monitoring the health of a messaging system.

The patterns are brought to life with examples implemented in messaging technologies,
such as JMS, SOAP, MSMQ, .NET, and other EAI Tools.

The solutions are relevant for a wide range of integration tools and platforms, such as IBM
WebSphere MQ, TIBCO, Vitria, WebMethods (Software AG), or Microsoft BizTalk,
messaging systems, such as JMS, WCF, Rabbit MQ, or MSMQ, ESB's such as Apache
Camel, Mule, WSO2, Oracle Service Bus, Open ESB, SonicMQ, Fiorano or Fuse
ServiceMix.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


EAI Patterns - Overview
Message Routing
Message Construction • Content-Based Router
• Message Filter
• Command Message
• Dynamic Router
• Document Message
• Recipient List
• Event Message
• Splitter
• Request-Reply
• Aggregator
• Return Address
• Resequencer
• Correlation Identifier
• Composed Msg. Processor
• Message Sequence
• Scatter-Gather
• Message Expiration
• Routing Slip
• Format Indicator
• Process Manager
• Message Broker
End Point

End Point
Application A Application B

Message End Points Message


Transformation
• Messaging Gateway
• Messaging Mapper Message Channels • Envelope Wrapper
• Transactional Client System Management • Content Enricher
• Polling Consumer • Point-to-Point Channel • Content Filter
• Event-Driven Consumer • Publish-Subscribe Channel • Control Bus • Claim Check
• Competing Consumers • Datatype Channel • Detour • Normalizer
• Message Dispatcher • Invalid Message Channel • Wire Tap • Canonical Data Model
• Selective Consumer • Dead Letter Channel • Message History
• Durable Subscriber • Guaranteed Delivery • Message Store
• Idempotent Receiver • Channel Adapter • Smart Proxy
• Service Activator • Messaging Bridge • Test Message
• Message Bus • Channel Purger
8
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Channels – Point
to Point
Send the message on a Point-to-Point Channel, which ensures that only one receiver will
receive a particular message.

A Point-to-Point Channel ensures that only one receiver consumes any given message. If
the channel has multiple receivers, only one of them can successfully consume a particular
message. The channel can still have multiple receivers to consume multiple messages
concurrently, but only a single receiver consumes any one message

Related Patterns: Command Message, Competing Consumers, Document Message,


Message, Message Channel, Messaging, Publish-Subscribe Channel, Request-Reply
9
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Channels –
Publisher - Subscriber
Send the event on a Publish-Subscribe Channel, which delivers a copy of a particular event
to each receiver.

It has one input channel that splits into multiple output channels, one for each subscriber.
When an event is published into the channel, the Publish-Subscribe Channel delivers a
copy of the message to each of the output channels..

Related Patterns: Competing Consumers, Durable Subscriber, Event Message, Message,


Message Channel, Message Store, Messaging, JMS Publish/Subscribe Example, Point-to-
Point Channel, Request-Reply
10
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Channels – Dead
Letter
When a messaging system determines that it cannot or should not deliver a message, it
may elect to move the message to a Dead Letter Channel.

The Dead Letter Channel works depends on the vendor specific implementation. channel
may be called a “dead message queue” or “dead letter queue” in MQSeries.

Related Patterns: Invalid Message Channel, Message Expiration, Selective Consumer,


Messaging 11
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Construction –
Command Message
Command Message is use to reliably invoke a procedure in another application.

Command Message is simply a regular message that happens to contain a command. In


JMS, the command message could be any type of message (Ex: ObjectMessage containing
a Serializable command object, a TextMessage containing the command in XML form, etc)
A Simple Object Access Protocol (SOAP) request is a command message

Related Patterns: Remote Procedure Invocation, Message, Message Channel, Messaging,


Point-to-Point Channel
12
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Construction –
Request Replay
Send a pair of Request-Reply messages, each on its own channel.

Request-Reply has two participants:

Related Patterns: Command Message, Correlation Identifier, Document Message, Remote


Procedure Invocation, Event Message, Guaranteed Delivery, Message, Message Channel,
Message Sequence, Messaging, Point-to-Point Channel, Polling Consumer, Publish-
Subscribe Channel, Return Address
13
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing – Content
Based Routing
Content-Based Router is used to route each message to the correct recipient based on
message content.

The Content-Based Router examines the message content and routes the message onto a
different channel based on data contained in the message. The Content-Based Router can
take on the form of a configurable rules engine that computes the destination channel
based on a set of configurable rules

Related Patterns: Dynamic Router, Message Filter, Invalid Message Channel, Message
Router, Pipes and Filters, Publish-Subscribe Channel, Routing Slip, Transactional Client
14
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing – Message
Filter
Message Filter is used to eliminate undesired messages from a channel based on a set of
criteria.

The Message Filter has only a single output channel. If the message content matches the
criteria specified by the Message Filter, the message is routed to the output channel. If the
message content does not match the criteria, the message is discarded

Related Patterns: Content-Based Router, Event-Driven Consumer, Message Router,


Selective Consumer, Publish-Subscribe Channel, Recipient List
15
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing – Dynamic
Router
Dynamic Router, a Router that can self-configure based on special configuration messages
from participating destinations.

The Dynamic Router stores the 'preferences' for each participant in a rule base. When a
message arrives, the Dynamic Router evaluates all rules and routes the message to the
recipient whose rules are fulfilled. This allows for efficient, predictive routing without the
maintenance dependency of the Dynamic Router on each potential recipient

Related Patterns: Content-Based Router, Message Filter, Message Router, Publish-


Subscribe Channel, Recipient List, Routing Slip
16
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing –
Recipient List
Recipient List is used to inspect an incoming message, determine the list of desired
recipients, and forward the message to all channels associated with the recipients in the list.

The logic embedded in a Recipient List can be pictured as two separate parts even though
the implementation is often coupled together. The first part computes a list of recipients. The
second part simply traverses the list and sends a copy of the received message to each
recipient. Just like a Content-Based Router, the Recipient List usually does not modify the
message contents

Related Patterns: Aggregator, Scatter-Gather, Introduction to Composed Messaging


Examples, Content-Based Router, Dynamic Router, Message Filter, Idempotent Receiver,
Message Router, Selective Consumer, Point-to-Point Channel, Publish-Subscribe Channel 17
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing – Splitter
Splitter is used to break out the composite message into a series of individual messages,
each containing data related to one item.

Splitter is used to consumes one message containing a list of repeating elements, each of
which can be processed individually. The Splitter publishes a one message for each single
element (or a subset of elements) from the original message

Related Patterns: Aggregator, Content-Based Router, Content Filter, Correlation Identifier,


Envelope Wrapper, Event-Driven Consumer, Pipes and Filters, Publish-Subscribe Channel
18
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing –
Aggregator
Use a stateful filter, an Aggregator, to collect and store individual messages until a complete
set of related messages has been received. Then, the Aggregator publishes a single
message distilled from the individual messages.
The Aggregator is a special Filter that receives a stream of messages and identifies
messages that are correlated. Once a complete set of messages has been received (more
on how to decide when a set is 'complete' below), the Aggregator collects information from
each correlated message and publishes a single, aggregated message to the output
channel for further processing.

Related Patterns: Scatter-Gather, Introduction to Composed Messaging Examples,


Content-Based Router, Control Bus, Correlation Identifier, Composed Message Processor,
Event-Driven Consumer, Event Message, Guaranteed Delivery, Message Expiration, Point-
to-Point Channel, Publish-Subscribe Channel, Recipient List, Resequencer, Splitter,
19
Transactional Client
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing –
Resequencer
Resequencer, to collect and re-order messages so that they can be published to the output
channel in a specified order.

The Resequencer can receive a stream of messages that may not arrive in order. The
Resequencer contains in internal buffer to store out-of-sequence messages until a complete
sequence is obtained. The in-sequence messages are then published to the output channel

Related Patterns: Aggregator, Competing Consumers, Message Router, Message


Sequence, Pipes and Filters, Splitter, Test Message
20
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Routing – Message
Broker
Message Broker receives messages from multiple destinations, determine the correct
destination and route the message to the correct channel. Implement the internals of the
Message Broker using the design patterns presented in this chapter.

Using a central Message Broker is sometimes referred to as hub-and-spoke architectural


style

Related Patterns: Canonical Data Model, Event-Driven Consumer, Message Channel,


Message Endpoint, Message Router, Pipes and Filters, Point-to-Point Channel, Publish-
Subscribe Channel, Recipient List 21
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Transformation –
Content Filter
Content Filter is used to remove unimportant data items from a message leaving only
important items.

The Content Filter does not necessarily just remove data elements. A Content Filter is also
useful to simplify the structure of the message. Often times, messages are represented as
tree structures. Many messages originating from external systems or packaged applications
contain many levels of nested, repeating groups because they are modeled after generic,
normalized database structures

Related Patterns: Channel Adapter, Content Enricher, Splitter


22
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Messaging Transformation –
Content Enricher
Content Enricher is to access an external data source in order to augment a message with
missing information.

The Content Enricher uses information inside the incoming message (e.g. key fields) to
retrieve data from an external source. After the Content Enricher retrieves the required data
from the resource, it appends the data to the message. The original information from the
incoming message may be carried over into the resulting message or may no longer be
needed, depending on the specific needs of the receiving application

Related Patterns: Content Filter, Event Message, Message Channel, Message Translator,
Claim Check 23
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Service Oriented Architecture (SOA)


24
SOA Introduction
Service-oriented architecture (SOA) is a style of software design where services are
provided to the other components by application components, through a communication
protocol over a network. The basic principles of service-oriented architecture are
independent of vendors, products and technologies.
A service is a discrete unit of functionality that can be accessed remotely and acted upon
and updated independently, such as retrieving a credit card statement online.

A service has four properties according to one of many definitions of SOA


• Logically represents a business activity with a specified outcome.
• Self-contained.
• Back box for its consumers.
• Consist of other underlying services

In 1996 the first report was published on SOA by the analysts Roy W.Schulte and Yefim
V.Natis

25

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Introduction
Service-orientation promotes loose coupling between services. SOA separates functions
into distinct units, or services. These services and their corresponding consumers
communicate with each other by passing data in a well-defined, shared format, or by
coordinating an activity between two or more services (Ex: Web Services)

A manifesto was published for service-oriented architecture in October, 2009. This came up
with six core values which are listed as follows
• Business value is given more importance than technical strategy.
• Strategic goals are given more importance than project-specific benefits.
• Intrinsic inter-operability is given more importance than custom integration.
• Shared services are given more importance than specific-purpose implementations.
• Flexibility is given more importance than optimization.
• Evolutionary refinement is given more importance than pursuit of initial perfection.

SOA can be seen as part of the continuum which ranges from the older concept of
distributed computing and modular programming, through SOA, and on to current practices
of mashups, SaaS, and cloud computing. 26

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Principles
There are no industry standards relating to the exact composition of a service-oriented
architecture, although many industry sources have published their own principles. Below
are the some of the principles out-of-them
• Standardized service contract - Services adhere to a standard communications
agreements, as defined collectively by one or more service-description documents
within a given set of services.
• Service reference autonomy (an aspect of loose coupling) - The relationship
between services is minimized to the level that they are only aware of their
existence.
• Service location transparency (an aspect of loose coupling) - Services can be
called from anywhere within the network that it is located no matter where it is
present.
• Service longevity - Services should be designed to be long lived.
• Service abstraction - The services act as black boxes, that is their inner logic is
hidden from the consumers.
• Service autonomy - Services are independent and control the functionality they
encapsulate, from a Design-time and a run-time perspective.
27

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Principles
• Service statelessness - Services are stateless, that is either return the requested
value or give an exception hence minimizing resource use.
• Service granularity - A principle to ensure services have an adequate size and
scope. The functionality provided by the service to the user must be relevant.
• Service normalization - Services are decomposed or consolidated (normalized) to
minimize redundancy.
• Service composability - Services can be used to compose other services.
• Service discovery - Services are supplemented with communicative meta data by
which they can be effectively discovered and interpreted.
• Service reusability - Logic is divided into various services, to promote reuse of
code.
• Service encapsulation - Many services which were not initially planned under
SOA, may get encapsulated or become a part of SOA.

28

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Features
Why to Use SOA:
• SOA is widely used in market which responds quickly and makes effective changes
according to market situations.
• The SOA keep secret the implementation details of the subsystems.
• Allows interaction of new channels with customers, partners and suppliers.
• Authorizes the companies to select software or hardware of their choice as it acts
as platform independence.

Features:
• Uses interfaces which solves the difficult integration problems in large systems.
• Communicates customers, providers and suppliers with messages by using the
XML schema.
• Uses the message monitoring to improve the performance measurement and
detects the security attacks.
• Reuses the service, there will be lower software development and management
costs.
29

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Advantages
Advantages:
• Allows reuse the service of an existing system alternately building the new system.
• Allows plugging in new services or upgrading existing services to place the new
business requirements.
• Enhance the performance, functionality of a service and easily makes the system
upgrade.
• Capable to adjust or modify the different external environments and large
applications can be managed easily.
• Companies can develop applications without replacing the existing applications.
• Provides reliable applications in which you can test and debug the independent
services easily as compared to large number of code..

30

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Disadvantages
Disadvantages:
• Requires high investment cost (means large investment on technology,
development and human resource).
• Greater overhead when a service interacts with another service which increases
the response time and machine load while validating the input parameters.
• Not suitable for GUI (graphical user interface) applications which will become more
complex when the SOA requires the heavy data exchange.

31

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Blueprint Concepts

Component
Services

Security Business
Services Services

SOA Blueprint

Work Flow Data


Services Services
Synchronous
&
Asynchronies
Services

32

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Blueprint
The following figure shows SOA blueprint with different classes

View Layer

P Application Layer
r
o Work Flow Rules CEP B
g
A
r
M
a
Enterprise Service Bus (ESB)
m
s

Web Services Systems

33

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Blueprint
SOA contains the main functions of blueprint which are called as Programs and BAM.
• Programs - The programs are associated with departmental issues which
manages the development, monitoring and operation of the SOA. The programs
include some areas such as managing services, operation and implementation of
service domains, roles of SOA project, conversion between roles and tasks.
• Business Activity Monitoring(BAM) - The business activity monitoring
functionality can be used by the products to display the runtime details in the
graphical system. The BAM products includes adapters or sensors which are used
to access the data using the Java, PL/SQL and other languages.
• View Layer - The view layer provides two types of applications; one is Rich Client
application and another one is Web Client application. The rich client application
processes the data on the client side and contains some locally installed programs
little network resources dependence. The web client is a client server side
component which contains applications running on user's computer and connected
to server.
• Application Server - The application server includes some functionalities such as
workflow, rules, registry, CEP, ESB, services and systems.

34

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Blueprint
• Workflow - The workflow is used when there is an interaction between human and
implementation which is done through the XPDL (XML Process Definition
Language).
• Rules - Rules can be modified or changed commonly at run time when they are not
incorporated in the system. Define the rules which are based on the system or
natural language, before becoming accessible by using the interfaces such as
Java, Web service etc. E.g.: JBoss rules, WebSphere ILOG rules, Visual rules and
Oracle business rules.
• CEP - Complex Event Processing (CEP) allows to browse event streams based on
the certain pattern which can be uncorrelated in time or content. The Continuous
Query Language (CQL) language contains SQL-style query language which
attaches the elements for organizing the data streams to the SQL language
constructs.
• ESB - Enterprise Service Bus (ESB) gives patterns that are liable for the tasks and
ranges from routing to reachability, allow the interaction between message and
protocol transformation and manages the SOA environment. The ESB is placed
between service provider and consumer which is used for service virtualization. The
services and systems are attached to the ESB.
35

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Maturity Model

Level-5
(Optimizing)
Level-4 • Associates with
(Managed) business
• Specifies the
Level-3 • Business activity endpoint of an
(Defined) monitoring architecture
functionality enterprise
Level-2 • Reuse of • Business process
(Repeatable) components • Interacts with
visibility services from
• Simple way of • Business process
Level-1 (Initial) • Low cost of modification customers,
delivery and service alerts partners and
• R&D • Changes the
experimentation • Low cost of business process others
maintenance
• Small SOA effectually
projects • Integration of • Providing
database
• Implementation business process
of portal and • Integration of rules
website application
• Process of • Managing the
custom performance
integration • Simple way of
• Number of deployment
services
36

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Security
There are different types of attacks to which SOA environment may become unprotected,
especially if it was implemented using web service technology. Most of the people all around
the world uses both SOA and web services which are rapidly developing areas, as a result
they become more complex and open to attacks. On SAO and web services, most of the
attacks takes place on the application service layer since web services communicate using
XML and soap messages.
Following is a list of attacks in SOA:
• Injection Attacks - This attack occurs when no validation on the user input is
performed and no separation is done between user input and application. For
example, SQL injection, XML injection etc.

• Schema Poisoning Attack - This attack when occurs, modifies, replaces or even
damages XML schemes that provides the structure of XML documents.

• Denial Of Service Attacks (DoS) - This attack when occurs, do not change the
service or its behavior but can block the use of the service.

37

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

EAI Vs ESB Vs SOA


38
EAI, ESB, SOA Pros

EAI ESB SOA


• Easy to quickly accomplish • Less customization • Reusability of services in
goals required other applications
• Guaranteed delivery • Consistency and good • Easy to update and
• Simplifies distributed practice in application
maintain
asynchronous computing integration
and access to data • Boost operational
• Greater reliability and
sources efficiency and agility by fewer software errors
• Greater flexibility consolidating apps • Location independent
• Allows reuse of data • Wide selection of tools • Scalable and available
across other applications • Easier operational support • Platform independence
due to transparency

39

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


EAI, ESB, SOA Cons

EAI ESB SOA


• More complex architecture • Risk of projects • Increased overall costs
• Steeper learning curve “bottlenecks” requires due to higher response
significant planning time and machine load
• Performance bottlenecks
• Difficult to find developers
possible • Complex service
with extensive ESB skills
• Difficulty accessing or management
maintaining business logic • Risk of regression
• Significant upfront
• Single point of failure
investment

40

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


EAI Vs ESB Vs SOA
EAI ESB SOA
• Architectural patterns • Technical implementations • Architectural patterns

• Integrates through system • Integrates through common • Enables a wider range of


output and occurs at the bus type architecture enterprise applications to be
system level (hub-based) integrated.
• Technology-driven - technical • Technology based Integrations • business-driven - a standards-
aspects of the integration based approach to business
process process integration
• Takes a bottom-up approach • Takes a bottom-up approach • Takes a top-down approach.
— propagating changes from and less customization Standards are defined for
one system to a cluster of required various integrations and taken
systems to each integration point
• Works with a system of • Integrate via a common • Provides components to
changes to integrate via a network vendor supports minimize changes to
common network application code
• Standardization depends on • Standardization depends on • works on standards, and
the vendor, and hence the vendor, and hence neutralizes (to some extent)
increases vendor dependency increases vendor dependency vendor dependency

41

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Microservices Architecture (MSA)


42
Microservices Introduction
Microservice is a software development technique, variant of the service-oriented
architecture (SOA) architectural style
Microservices architecture, services are fine-grained and the protocols are lightweight.
Benefit of decomposing an application into different smaller services is that it improves
modularity and makes the application easier to understand, develop, and test and more
resilient to architecture
Parallelizes the development by enabling small autonomous teams to develop, deploy and
scale their respective services independently
Allows the architecture of an individual service to emerge through continuous refactoring.
Microservices-based architectures enable continuous delivery and deployment.
May-2011 used the term “Microservice” in Architects workshop held at Venice
Microservices approach is a first realization of SOA that followed the introduction of DevOps
and is becoming more popular for building continuously deployed systems
Amazon, Netflix and Twitter are using widely using Microservice

43

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Microservices Features
• Decoupling – Services within a system are largely decoupled. So the application as a
whole can be easily built, altered, and scaled
• Componentization – Microservices are treated as independent components that can be
easily replaced and upgraded
• Business Capabilities – Microservices are very simple and focus on a single capability
• Autonomy – Developers and teams can work independently of each other, thus
increasing speed
• Continuous Delivery – Allows frequent releases of software, through systematic
automation of software creation, testing, and approval
• Responsibility – Microservices do not focus on applications as projects. Instead, they
treat applications as products for which they are responsible
• Decentralized Governance – Focus is on using the right tool for the right job. That
means there is no standardized pattern or any technology pattern. Developers have the
freedom to choose the best useful tools to solve their problems
• Agility – Support agile development. Any new feature can be quickly developed and
discarded again 44

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Microservices Advantages
• Independent Development – All microservices can be developed independently based
on their functionality
• Independent Deployment – Based on their services, they can be individually deployed
in any application
• Fault Isolation – Even if one service of the application does not work, the system still
continues to function
• Mixed Technology Stack – Different languages and technologies can be used to build
different services of the same application
• Granular Scaling – Individual components can scale as per need, there is no need to
scale all components together

45

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Microservices Architecture

• Different clients from different devices


User Interface • All services are separated based on their
domains and functionalities
• Microservices have their own load
balancer and execution environment to
API execute their functionalities
Gateway
• Microservices communicate with each
other through a stateless server which is
either REST or Message Bus
• Communication with the help of Service
Microservice Microservice Microservice Microservice Discovery and perform operational
capabilities
• Communicated to clients via API Gateway
DB DB DB DB • Internal points are connected from the API
Gateway

46

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

SOA Vs MSA Architecture


47
SOA Vs MSA
Service-oriented architecture is essentially a collection of services. These services
communicate with each other. The communication can involve either simple data passing or
two or more services.
Microservices is an architectural style that structures an application as a collection of small
autonomous services modeled around a business domain

Monolithic SOA Microservice

48

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Vs MSA
SOA defines four basic service types described as below:
• Business Services:
o Coarse-grained services that define core business operations.
o Represented through XML, Business Process Execution Language (BPEL), and
others.
• Enterprise Services:
o Implement the functionality defined by business services.
o Mainly rely on application services and infrastructure services to fulfill business
requests.
• Application Services:
o Fine-grained services that are confined to a specific application context.
o A dedicated user interface can directly invoke the services.
• Infrastructure Services:
o Implement non-functional tasks such as authentication, auditing, security, and
logging.
o Can be invoked from either application services or enterprise services. 49

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Vs MSA
MSA defines two service types described as below:
• Functional Services:
o Support specific business operations.
o Accessing of services is done externally and these services are not shared with
other services.

• Infrastructure Services
o Implement tasks such as auditing, security, and logging
o Services are not unveiled to the outside world. :

50

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Vs MSA

SOA MSA
“share-as-much-as-possible” architecture approach “share-as-little-as-possible” architecture approach

Focus on business functionality reuse Focus on the concept of “bounded context”

Common governance and standards People, collaboration and freedom of other options

Enterprise Service bus (ESB) for communication Simple messaging system

Support multiple message protocols Uses lightweight protocols such as HTTP/REST

Multi-threaded with more overheads to handle I/O Single-threaded usually with the use of Event Loop

Maximizes application service reusability Focuses on decoupling

Traditional Relational Databases are more often Modern Relational Databases are more often used
used
A systematic change requires modifying the A systematic change is to create a new service
monolith
DevOps / Continuous Delivery is not a mainstream Strong focus on DevOps / Continuous Delivery

51

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Vs MSA

SOA Architecture MSA Architecture

Services / API’s

Application Services / API’s

Application Server

Runtime Environment Runtime Environment

OS OS

Hyper vision Hyper vision

Storage Storage

Network Network
52

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Architecture Shift from N-Tier to


MSA
53
N-Tier Architecture

Client Layer – User interacts the application using


Browser / Mobile Browser
Client Layer (Browsers)
The Server Layer sits between the Client and Storage
JSP / HTML / CSS / JS layers. Server Layer is usually further divided into
multiple sub-layers: Web, Business, and Persistence
Service Layer (Application server)
• Web Layer is the entry point of the application on the server
side, and is responsible for handling user interactions,
MVC Based Web Layer – Struts, Spring, converting requests to models, generating and delivering
MVC dynamic User Interfaces, session management, and other
tasks
• Business Layer is where business logic is implemented as a
Business Layer – Beans, EJB’s, POJOS
carefully composed and well defined API
• Server Persistence Layer is responsible for abstracting away
the application’s interaction with the Storage Layer’s specific
Persistence Layer – JDBC, Hibernate etc., relational database via Object Relational Mapping (ORM)
tools like Hibernate

The Storage Layer retains important data into relational


Storage Layer (Database) database system like MySQL, Oracle, or SQL Server.

DB DB
54

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Single Page Applications
(SPA) Architecture
Single-Page Applications (SPAs) are Web apps that
load a single HTML page and dynamically update that
Client Layer (Browsers)
page as the user interacts with the app using Services.

Java Script Frameworks (AngularJS etc.,) SPAs use JavaScript frameworks and HTML5 to create
fluid and responsive Web apps, without constant page
reloads. This means much of the work happens on the
REST / SOAP Service Layer
client side, in JavaScript.

All the front end pages are connected to REST / SOAP


Service Layer (Application server) services.
Business Layer – Beans, EJB’s, POJOS JavaScript frameworks like Angular, React etc., are
used for developing single page applications

Persistence Layer – JDBC, Hibernate etc., The REST services interact with Business layer for
business operations

Storage Layer (Database) The Storage Layer retains important data into relational
database system like MySQL, Oracle, or SQL Server
DB DB
55

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Microservices (MSA)
Architecture
A microservice is a tiny application that implements just
a small subset of the full applications functionalities.

Refactor (or design) the backend to leverage third-party


hosted services for cross cutting concerns
Client Layer (Browsers)
Java Script Frameworks (AngularJS etc.,) Numerous microservices increases the complexity in
distributed management, inter microservice
communication, authentication and authorization,
API Layer distributed logging and tracing, service registration and
discovery, reverse proxy and gateways, etc.

There are frameworks like Spring can help to


implementation microservices easily
Microservice Microservice Microservice
Microservices allow an application to scale horizontally
and change independently,
DB DB DB

56

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

SOA Layout
57
SOA Layout

58

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


SOA Layout
Business Services
• As mentioned above business processes are a mere sequence of interconnected tasks. These
are often called business service (though sometimes the term is also used to describe a
technical front-end used to trigger a business process). Business services thus are vital for
business processes to do something. Business service interfaces must be designed according
to functional aspects.
• This is necessary to create durable interface, increase usability as well as reusability. That is
why often standard data formats can be utilized here with great effect. Usable standards can be
defined by examining which data is needed in a certain application domain. In a second step
business objects are derived from this work.

Implementation Services
• Implementation services close the gap between business service and a concrete service
provider (application, system). This type of service converts such a component to a usable unit
in the context of SOA.
• This is a rather complex task in the case of so-called “legacy applications” which simply were
not designed to work with other systems in the way needed. Most of the time these systems
offer interfaces which are however not readily useable in an SOA environment.

59

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

NoSQL Databases
60
NoSQL Database
NoSQL databases are built for specific data models and have flexible schemas for building
modern applications.
NoSQL databases are widely recognized for their ease of development, functionality, and
performance at scale.
They use a variety of data models, including document, graph, key-value, in-memory, and
search. This page includes resources to help you better understand NoSQL databases and
to get started.

The predominant data model that was used for application development was the relational
data model used by relational databases such as Oracle, DB2, SQL Server, MySQL, and
PostgreSQL. It wasn’t until the mid to late 2000s that other data models began to gain
significant adoption and usage. To differentiate and categorize these new classes of
databases and data models, the term “NoSQL” was coined. Often the term “NoSQL” is used
interchangeably with “nonrelational.”

61

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


How Does NoSQL Database
NoSQL databases use a variety of data models for accessing and managing data, such as
document, graph, key-value, in-memory, and search. These types of databases are
optimized specifically for applications that require large data volume, low latency, and
flexible data models, which are achieved by relaxing some of the data consistency
restrictions of other databases.

Consider the example of modeling the schema for a simple book database:
• In a relational database, a book record is often dissembled (or “normalized”) and stored
in separate tables, and relationships are defined by primary and foreign key constraints.
o For Example, the Books table has columns for Book ID, Book Title, and Edition
Number, the Authors table has columns for Author ID and Author Name, and finally
the Author-ISBN table has columns for Author ID and Book ID. The relational model
is designed to enable the database to enforce referential integrity between tables in
the database, normalized to reduce the redundancy, and generally optimized for
storage.
• In a NoSQL database, a book record is usually stored as a JSON document.
o For each book, the item, Book ID, Book Title, Edition Number, Author Name, and
Author ID are stored as attributes in a single document. In this model, data is
62
optimized for intuitive development and horizontal scalability.
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
NoSQL Database Advantages
NoSQL databases are a great fit for many modern applications such as mobile, web, and
gaming that require flexible, scalable, high-performance, and highly functional databases to
provide great user experiences.
• Flexibility - NoSQL databases provide flexible schemas that enable faster and
more iterative development. The flexible data model makes NoSQL databases ideal
for semi-structured and unstructured data.
• Scalability - NoSQL databases are designed to scale out by using distributed
clusters of hardware instead of scaling up by adding expensive and robust servers.
Some cloud providers handle these operations behind-the-scenes as a fully
managed service.
• High-performance - NoSQL database are optimized for specific data models (such
as document, key-value, and graph) and access patterns that enable higher
performance than trying to accomplish similar functionality with relational
databases.
• Highly functional - NoSQL databases provide highly functional APIs and data
types that are purpose built for each of their respective data models.

63

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


NoSQL Database Types
Key-value - Key-value databases are highly partitionable and allow horizontal scaling at
scales that other types of databases cannot achieve.
Use cases such as gaming, ad tech, and IoT lend themselves particularly well to the key-
value data model. Amazon DynamoDB is designed to provide consistent single-digit
millisecond latency for any scale of workloads. This consistent performance is a big part of
why the Snapchat Stories feature, which includes Snapchat's largest storage write
workload, moved to DynamoDB.

Document - Developers do not think of their data model in terms of denormalized rows and
columns. Typically, in the application tier, data is represented as a JSON document because
it is more intuitive for developers to think of their data model as a document.
The popularity of document databases has grown because developers can persist data in a
database by using the same document model format that they use in their application code.
DynamoDB and MongoDB are popular document databases that provide powerful and
intuitive APIs for flexible and agile development.

64

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


NoSQL Database Types
Graph - A graph database’s purpose is to make it easy to build and run applications that
work with highly connected datasets.
Typical use cases for a graph database include social networking, recommendation
engines, fraud detection, and knowledge graphs. Amazon Neptune is a fully-managed
graph database service. Neptune supports both the Property Graph model and the
Resource Description Framework (RDF), providing the choice of two graph APIs: TinkerPop
and RDF/SPARQL. Popular graph databases include Neo4j and Giraph.

In-memory - Gaming and ad-tech applications have use cases such as leaderboards,
session stores, and real-time analytics that require microsecond response times and can
have large spikes in traffic coming at any time. Amazon Elasti Cache offers Memcached
and Redis, to serve low-latency, high-throughput workloads, such as McDonald’s, that
cannot be served with disk-based data stores. Amazon DynamoDB Accelerator (DAX) is
another example of a purpose-built data store. DAX makes DynamoDB reads an order of
magnitude faster.

65

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


NoSQL Database Types
Search - Many applications output logs to help developers troubleshoot issues. Amazon
Elasticsearch Service (Amazon ES) is purpose built for providing near-real-time
visualizations and analytics of machine-generated data by indexing, aggregating, and
searching semi structured logs and metrics. Amazon ES also is a powerful, high-
performance search engine for full-text search use cases. Expedia is using more than 150
Amazon ES domains, 30 TB of data, and 30 billion documents for a variety of mission-
critical use cases, ranging from operational monitoring and troubleshooting to distributed
application stack tracing and pricing optimization.

66

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


NoSQL Database Types
A more detailed classification is the following

Type Examples of NoSQL DB’s


Cache Apache Ignite, Coherence, eXtreme Scale, Hazelcast, Infinispan, Memcached,
Key-Value Cache
Velocity
Key-Value Store ArangoDB, Aerospike
Key-Value Store
Oracle NoSQL Database, Dynamo, Riak, Voldemort
(Eventually-Consistent)
Key-Value Store
FoundationDB, InfinityDB, LMDB, MemcacheDB
(Ordered)
Data-Structures Server Redis

Tuple Store Apache River, GigaSpaces

Object Database Objectivity/DB, Perst, ZopeDB


ArangoDB, BaseX, Clusterpoint, Couchbase, CouchDB, DocumentDB, IBM Domino,
Document Store
MarkLogic, MongoDB, Qizx, RethinkDB
Wide Column Store Amazon DynamoDB, Bigtable, Cassandra, Druid, HBase, Hypertable
Native Multi-model
ArangoDB, Cosmos DB, OrientDB
Database
67

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Relational Vs NoSQL
Databases
Description Relational Database NoSQL Database
Optimal workloads Relational databases are designed for NoSQL key-value, document, graph, and in-
transactional and strongly consistent online memory databases are designed for OLTP for a
transaction processing (OLTP) applications and number of data access patterns that include low-
are good for online analytical processing (OLAP). latency applications. NoSQL search databases
are designed for analytics over semi-structured
data.
ACID properties Relational databases provide atomicity, NoSQL databases often make tradeoffs by
consistency, isolation, and durability (ACID) relaxing some of the ACID properties of relational
properties: databases for a more flexible data model that can
scale horizontally. This makes NoSQL databases
• Atomicity requires a transaction to execute an excellent choice for high throughput, low-
completely or not at all. latency use cases that need to scale horizontally
• Consistency requires that when a transaction beyond the limitations of a single instance.
has been committed, the data must conform to
the database schema.
• Isolation requires that concurrent transactions
execute separately from each other.
• Durability requires the ability to recover from
an unexpected system failure or power outage
to the last known state.

68

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Relational Vs NoSQL
Databases
Description Relational Database NoSQL Database
Data model The relational model normalizes data into tables NoSQL databases provide a variety of data
that are composed of rows and columns. A models that includes document, graph, key-value,
schema strictly defines the tables, rows, in-memory, and search
columns, indexes, relationships between tables,
and other database elements. The database
enforces the referential integrity in relationships
between tables.
Performance Performance is generally dependent on the disk Performance is generally a function of the
subsystem. The optimization of queries, indexes, underlying hardware cluster size, network latency,
and table structure is often required to achieve and the calling application
peak performance.
Scale Relational databases typically scale up by NoSQL databases typically are partitionable
increasing the compute capabilities of the because key-value access patterns are able to
hardware or scale-out by adding replicas for scale out by using distributed architecture to
read-only workloads increase throughput that provides consistent
performance at near boundless scale
APIs Requests to store and retrieve data are Object-based APIs allow app developers to easily
communicated using queries that conform to a store and retrieve in-memory data structures.
structured query language (SQL). These queries Partition keys let apps look up key-value pairs,
are parsed and executed by the relational column sets, or semistructured documents that
database contain serialized app objects and attributes

69

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Relational Vs NoSQL
Terminology
SQL MongoDB DynamoDB Cassandra Couchbase
Table Collection Table Table Data bucket
Row Document Item Row Document
Column Field Attribute Column Field
Primary key ObjectId Primary key Primary key Document ID

Index Index Secondary index Index Index


Global secondary
View View Materialized view View
index
Nested table or Embedded
Map Map Map
object document
Array Array List List List

70

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


NoSQL DB Performance
Ben Scofield rated different categories of NoSQL databases as follows
Data model Performance Scalability Flexibility Complexity Functionality
Key–value
high high high none variable
store
Column-
high high moderate low minimal
oriented store
Document-
high variable high Low variable
oriented store
Graph
variable variable high High graph theory
database
Relational relational
variable variable low moderate
database algebra

71

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

CAP Theorem
72
CAP Theorem (Brewer’s
Theorem)
CAP theorem states that there are three basic requirements which exist in a special relation
when designing applications for a distributed architecture.
• Consistency – The data in the database remains consistent after the execution of
an operation. For example after an update operation all clients see the same data.
• Availability - The system is always on (service guarantee availability), no
downtime.
• Partition Tolerance - The system continues to function even the communication
among the servers is unreliable, i.e. the servers may be partitioned into multiple
groups that cannot communicate with one another.
In theoretically it is impossible to fulfill all 3 requirements. CAP provides the basic
requirements for a distributed system to follow 2 of the 3 requirements. Therefore all the
current NoSQL database follow the different combinations of the C, A, P from the CAP
theorem. Here is the brief description of three combinations CA, CP, AP :
• CA - Single site cluster, therefore all nodes are always in contact. When a partition
occurs, the system blocks.
• CP -Some data may not be accessible, but the rest is still consistent/accurate.
• AP - System is still available under partitioning, but some of the data returned may
be inaccurate. 73

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


CAP Theorem (Brewer’s
Theorem)

74

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

MongoDB
75
MongoDB
MongoDB is an open-source document database and leading NoSQL database. MongoDB
is written in C++.
MongoDB is a cross-platform, document oriented database that provides, high
performance, high availability, and easy scalability. MongoDB works on concept of collection
and document
• Collection is a group of MongoDB documents. It is the equivalent of an RDBMS
table. A collection exists within a single database. Collections do not enforce a
schema. Documents within a collection can have different fields. Typically, all
documents in a collection are of similar or related purpose
• A document is a set of key-value pairs. Documents have dynamic schema.
Dynamic schema means that documents in the same collection do not need to
have the same set of fields or structure, and common fields in a collection's
documents may hold different types of data.
Database is a physical container for collections. Each database gets its own set of files on
the file system. A single MongoDB server typically has multiple databases

76

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


MongoDB Advantages Over
RDBMS
• Schema less − MongoDB is a document database in which one collection holds different
documents. Number of fields, content and size of the document can differ from one
document to another.
• Structure of a single object is clear.
• No complex joins.
• Deep query-ability. MongoDB supports dynamic queries on documents using a
document-based query language that's nearly as powerful as SQL.
• Tuning.
• Ease of scale-out.
• Conversion/mapping of application objects to database objects not needed.
• Uses internal memory for storing the (windowed) working set, enabling faster access of
data

77

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


MongoDB – Where to Use
• Big Data
• Content Management and Delivery
• Mobile and Social Infrastructure
• User Data Management
• Data Hub

78

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Caching
79
Caching
In computing, a cache is a high-speed data storage layer which stores a subset of data,
typically transient in nature, so that future requests for that data are served up faster than is
possible by accessing the data’s primary storage location. Caching allows you to efficiently
reuse previously retrieved or computed data.

The data in a cache is generally stored in fast access hardware such as RAM (Random-
access memory) and may also be used in correlation with a software component. A cache's
primary purpose is to increase data retrieval performance by reducing the need to access
the underlying slower storage layer.

Trading off capacity for speed, a cache typically stores a subset of data transiently, in
contrast to databases whose data is usually complete and durable.

80

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching Overview
RAM and In-Memory Engines - Due to the high request rates or IOPS (Input / Output
operations per second) supported by RAM and In-Memory engines, caching results in
improved data retrieval performance and reduces cost at scale. To support the same scale
with traditional databases and disk-based hardware, additional resources would be
required. These additional resources drive up cost and still fail to achieve the low latency
performance provided by an In-Memory cache

Applications - Caches can be applied and leveraged throughout various layers of


technology including Operating Systems, Networking layers including Content Delivery
Networks (CDN) and DNS, web applications, and Databases. Use caching to significantly
reduce latency and improve IOPS for many read-heavy application workloads, such as Q&A
portals, gaming, media sharing, and social networking.
Cached information can include the results of database queries, computationally intensive
calculations, API requests/responses and web artifacts such as HTML, JavaScript, and
image files.

81

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching Overview
Design Patterns - In a distributed computing environment, a dedicated caching layer
enables systems and applications to run independently from the cache with their own
lifecycles without the risk of affecting the cache. The cache serves as a central layer that
can be accessed from disparate systems with its own lifecycle and architectural topology.
Caching Best Practices - When implementing a cache layer, it’s important to understand
the validity of the data being cached. A successful cache results in a high hit rate which
means the data was present when fetched. A cache miss occurs when the data fetched was
not present in the cache. Controls such as TTLs (Time to live) can be applied to expire the
data accordingly.
Another consideration may be whether or not the cache environment needs to be Highly
Available, which can be satisfied by In-Memory engines such as Redis. In some cases, an
In-Memory layer can be used as a standalone data storage layer in contrast to caching data
from a primary location. In this scenario, it’s important to define an appropriate RTO
(Recovery Time Objective--the time it takes to recover from an outage) and RPO (Recovery
Point Objective--the last point or transaction captured in the recovery) on the data resident
in the In-Memory engine to determine whether or not this is suitable. Design strategies and
characteristics of different In-Memory engines can be applied to meet most RTO and RPO
requirements.
82

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching Overview

Mobile / Desktops

Internet Web Content Applications Database

Client-Side DNS Web Content Application Database


Accelerate Accelerate retrieval of
Accelerate Reduce latency
retrieval of web web content from
Domain to IP application associated with
Use Case content from web/app servers. Manage
Resolution performance and database query
websites (browser Web Sessions (server
data access requests
or device) side)
HTTP Cache Headers,
HTTP Cache Key/Value data Database buffers,
CDNs, Reverse Proxies,
Technologies Headers, DNS Servers stores, Local Key/Value data
Web Accelerators,
Browsers caches stores
Key/Value Stores
Application
Amazon CloudFront,
Frameworks,
ElastiCache for Redis, ElastiCache for
Amazon ElastiCache for
Solutions Browser Specific ElastiCache for Redis /
Route 53 Redis /
Memcached, Partner Memcached
Memcached,
Solutions
Partner Solutions

83

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching Benefits
Improve Application Performance - Memory is orders of magnitude faster than disk
(magnetic or SSD), reading data from in-memory cache is extremely fast (sub-millisecond).
This significantly faster data access improves the overall performance of the application.

Predictable Performance - A common challenge in modern applications is dealing with


times of spikes in application usage. Examples include social apps during the Super Bowl or
election day, eCommerce websites during Black Friday, etc. Increased load on the database
results in higher latencies to get data, making the overall application performance
unpredictable. By utilizing a high throughput in-memory cache this issue can be mitigated.

Reduce Database Cost - A single cache instance can provide hundreds of thousands of
IOPS (Input/output operations per second), potentially replacing a number of database
instances, thus driving the total cost down. This is especially significant if the primary
database charges per throughput. In those cases the price savings could be dozens of
percentage points.

84

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching Benefits
Eliminate Database Hotspots - Many applications, it is likely that a small subset of data,
such as a celebrity profile or popular product, will be accessed more frequently than the
rest. This can result in hot spots in your database and may require overprovisioning of
database resources based on the throughput requirements for the most frequently used
data. Storing common keys in an in-memory cache mitigates the need to overprovision
while providing fast and predictable performance for the most commonly accessed data

Reduce the Load on the Backend - By redirecting significant parts of the read load from
the backend database to the in-memory layer, caching can reduce the load on your
database, and protect it from slower performance under load, or even from crashing at
times of spikes

Increase Read Throughput (IOPS) - Lower latency, in-memory systems offer much higher
request rates (IOPS) relative to a comparable disk-based database. A single instance used
as a distributed side-cache can serve hundreds of thousands of requests per second

85

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching Performance
The cache performance can be explained using the following steps:

Process needs some data, it first searches in the cache memory. If the data is available in
the cache, this is termed as a cache hit and the data is accessed as required. If the data is
not in the cache then it is termed as a cache miss. Then the data is obtained from the main
memory. After that the data is transferred to the cache memory under the assumption that it
will be needed again.

The performance of the cache is measured using the hit ratio. It is the number of cache hits
divided by the total cache accesses. The formula for this is:

Hit Ratio = Number of Cache Hits


(Number of Cache Hits + Number of Cache Misses)

86

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Type of Caching
There are mainly two types of cache memory i.e. primary cache and secondary cache.
These are explained in detail as follows:

Primary Cache - Primary cache is very fast and its access time is similar to the processor
registers. This is because it is built onto the processor chip. However because of this
reason, its size is quite small. It is also known as a level 1 cache and is build using static
RAM (SRAM).

Secondary Cache - The secondary cache or external cache is cache memory that is
external to the primary cache. It is located between the primary cache and the main
memory. It is also known as a level 2 cache and is often housed on the processor chip as
well.

87

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching - Ehcache
Ehcache is an open source Java distributed cache for general purpose caching, Ehcache is
available under an Apache open source license.

Ehcache was developed by Greg Luck starting in 2003. In 2009, the project was purchased
by Terracotta (provides paid support).

Ehcache can be configured with multiple frameworks and ORM tools like Hibernate.

Clustering of cache would be performed using Terracotta. Distributed caching allows to


harness additional benefits of horizontal scale-out, without losing of data.

Alternatives of Ehcache:
• Terracotta
• Hazelcast
• Memcached
• Couchbase Server 88

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching - Memcached
An open source project designed to make use of the spare RAM in many servers to act as a
memory cache for frequently accessed pieces of information. Memcached is a general-
purpose distributed memory caching system that was originally developed by Danga
Interactive for LiveJournal.

Currently it is used by many sites like browser


YouTube, Reddit, Zynga, Face book Response
and Twitter. Request served from
Memcached
Application Server
It is often used to speed up dynamic
First time Caching
database-driven websites by caching retrieval
data and objects in RAM to reduce the
Memcache Memcache
number of times an external data
RDBMS RDBMS
source such as a database or API) must Memcache Memcache
be read

89

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching – Traditional Vs
Memcached
Java Caching:
Traditional Java caching framework is quite
easy, regardless of whether we choose an
open source or commercial option.
It uses replication for distributed caching,
means if a cache entry is added on
AppServer1 it is automatically replicated to
the other application servers in the system.

Memcached:
When an object is added to cache, the
Memcached client will take that object,
serialize it, and send a byte array to the
Memcached server for storage
if application is running on more than one
application server, all of them can point to
the same Memcached server and use it for
getting and setting cache entries
90

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Caching – Memcached
Advantages / Disadvantages
Advantages:
• Shared memory allows multiple processes to share a single cache
• Cache requests can be distributed over multiple instances
• Cross application and cross Platform Engine meaning the same server can be accessed
from a variety of languages - PHP, Java and .NET and from Windows, Linux etc.
• Reading from Memcached is often significantly faster than reading from a database.
Especially when content has been pre-sorted and pre-filtered, and is cached in a
serialized object format (e.g. JSON) that can be quickly reconstituted by the application.

Disadvantages:
• Applications need to be designed with Memcached support in mind
• It’s volatile memory and shouldn’t be used to store anything that you can’t repopulate from
a persistent source (like the file system or a database)
• It’s yet another process running on the server.
• No means of authentication making data insecure
• Memcached works as an external service which means that externally needs to be
91
installed / run in production environment
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Caching – Apache Camel
The Ehcache component enables the applications to perform caching operations using
Ehcache 3 as the Cache Implementation. This component supports producer and event
based consumer endpoints. The Cache consumer is an event based consumer and can be
used to listen and respond to specific cache activities.

Another way of Camel application caching with most powerful and secure way was JMS
replication.

92

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Cloud
93
Cloud Basics
Cloud computing is shared pools of configurable computer system resources and higher-
level services that can be rapidly provisioned with minimal management effort, often over
the Internet.
Cloud computing relies on sharing of resources to achieve coherence and economies of
scale, similar to a public utility
Cloud Computing refers to manipulating, configuring, and accessing the hardware and
software resources remotely. Offers online data storage, infrastructure, and application.
Cloud computing offers platform independency, as the software is not required to be
installed locally on the PC. Hence, the Cloud Computing is making our business
applications mobile and collaborative
Following are the working models for cloud computing:
• Deployment Models
• Service Models

94

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Deployment Models
There are four different cloud models that you can subscribe according to business needs:

PUBLIC CLOUD - The public cloud allows systems and services to be easily accessible to
the general public. Public cloud may be less secure because of its openness.

PRIVATE CLOUD - The private cloud allows systems and services to be accessible within
an organization. It is more secured because of its private nature.

COMMUNITY CLOUD - The community cloud allows systems and services to be accessible
by a group of organizations.

HYBRID CLOUD - The hybrid cloud is a mixture of public and private cloud, in which the
critical activities are performed using private cloud while the non-critical activities are
performed using public cloud.

95

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Service Models
Cloud computing is based on service models. These are
categorized into three basic service models which are
• Infrastructure-as–a-Service (IaaS)
• Platform-as-a-Service (PaaS)
• Software-as-a-Service (SaaS)

IaaS
INFRASTRUCTURE-AS-A-SERVICE (IAAS) - IaaS provides
access to fundamental resources such as physical machines,
virtual machines, virtual storage, etc. Service
Models

PLATFORM-AS-A-SERVICE (PAAS) - PaaS provides the


PaaS SaaS
runtime environment for applications, development and
deployment tools, etc.

SOFTWARE-AS-A-SERVICE (SAAS) - SaaS model allows


to use software applications as a service to end-users.
96

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


History of Cloud Computing
The concept of Cloud Computing came into existence in the year 1950 with implementation
of mainframe computers, accessible via thin/static clients. Since then, cloud computing has
been evolved from static clients to dynamic ones and from software to services. The
following diagram explains the evolution of cloud computing

Cloud
Computing

Mainframes Raise of PC Client / Server Hosted Cloud


(1950’s) (1960’s) (1990’s) Environment Computing
• Start of • Personal Desk • Virtual Private (2000’s) (2010’s)
Automation • Decentralized Network • Infra Mgmt. • Emerging “As a
Phase • IT Service • Demand of • Virtualization Service”
• Localized Industry birth bandwidth • Utility / • Delivery of
Infrastructure • Dot Com Collaborative “IaaS, PaaS,
revaluation computing SaaS, NaaS,
iPaaS”

97

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Benefits
Cloud Computing has numerous advantages. Some of them are listed below -
• One can access applications as utilities, over the Internet.
• One can manipulate and configure the applications online at any time.
• Does not require to install a software to access or manipulate cloud application.
• Cloud Computing offers online development and deployment tools, programming
runtime environment through PaaS model.
• Cloud resources are available over the network in a manner that provide platform
independent access to any type of clients.
• Cloud Computing offers on-demand self-service. The resources can be used
without interaction with cloud service provider.
• Cloud Computing is highly cost effective because it operates at high efficiency with
optimum utilization. It just requires an Internet connection
• Cloud Computing offers load balancing that makes it more reliable.

98

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Advantages
Cost-Efficient − Building own servers and tools is time-consuming as well as expensive as
we need to order, pay for, install, and configure expensive hardware, long before we need it.
However, using cloud computing, we only pay for the amount as per use the computing
resources.
Reliability − A cloud computing platform provides much more managed, reliable and
consistent service than an in-house infrastructure. Guarantees 24x7 and 365 days of
service. If any of the server fails, then hosted applications and services can easily be
transited to any of the available servers.
Unlimited Storage − Cloud computing provides unlimited storage capacity, i.e., we need
not worry about running out of storage space or increasing our current storage space
availability.
Backup & Recovery − Storing data in the cloud, backing it up and restoring the same is
relatively easier than storing it on a physical device. The cloud service providers also have
enough technology to recover our data, so there is the convenience of recovering our data
anytime.
Easy Access to Information − Access cloud account from anywhere in the world provided
there is internet connection at that point. There are various storage and security facilities
that vary with the account type chosen.
99

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Disadvantages
Security - Security is the major concerns in cloud computing. The cloud service providers
implement the best security standards and industry certifications, however, storing data and
important files on external service providers always bears a risk.
AWS cloud infrastructure is designed to be the most flexible and secured cloud network. It
provides scalable and highly reliable platform that enables customers to deploy applications
and data quickly and securely.

Technical - Cloud service providers offer services to number of clients each day,
Sometimes the system can have some serious issues leading to business processes
temporarily being suspended. Additionally, if the internet connection is offline then we will
not be able to access any of the applications, server, or data from the cloud.

Not Easy to Switch Service Providers - Cloud service providers promises vendors that
the cloud will be flexible to use and integrate, however switching cloud services is not easy.
Most organizations may find it difficult to host and integrate current cloud applications on
another platform. Interoperability and support issues may arise such as applications
developed on Linux platform may not work properly on Microsoft Development Framework
100

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Cloud Computing
Technologies
There are certain technologies working behind the cloud computing platforms making cloud
computing flexible, reliable, and usable. These technologies are listed below:
• Virtualization
• Service-Oriented Architecture (SOA)
• Grid Computing
• Utility Computing

Virtualization - Virtualization is a technique, which allows to share single physical instance


of an application or resource among multiple organizations or tenants (customers). It does
this by assigning a logical name to a physical resource and providing a pointer to that
physical resource when demanded.
VM VM VM
Machine Machine Machine
The Multitenant architecture offers virtual
isolation among the multiple tenants VM Infrastructure (Hypervisor)

Network and Storage


101

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Cloud Computing
Technologies
Service-Oriented Architecture (SOA) - Service-Oriented Architecture helps to use
applications as a service for other applications regardless the type of vendor, product or
technology. Therefore, it is possible to exchange the data between applications of different
vendors without additional programming or making changes to services

Mobile App Web App Business App

Integration Platform

Catalog Locator Services

102

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Cloud Computing
Technologies
Grid Computing - Grid Computing refers to distributed computing, in which a group of
computers from multiple locations are connected with each other to achieve a common
objective. These computer resources are heterogeneous and geographically dispersed.

Grid Computing breaks complex task into smaller pieces, which are distributed to CPUs that
reside within the grid

Desk tops Mobile

Grid Computing

Laptops
Servers 103

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Cloud Computing
Technologies
Grid Computing - Grid Computing refers to
distributed computing, in which a group of
computers from multiple locations are Desk tops Mobile
connected with each other to achieve a
common objective. These computer resources
are heterogeneous and geographically
Grid Computing
dispersed.

Grid Computing breaks complex task into Laptops Servers


smaller pieces, which are distributed to CPUs
that reside within the grid

Utility Computing - Utility computing is the process of providing service through an on-
demand, pay per use billing method. It offers computational resources on demand as a
metered service. Cloud computing, grid computing, and managed IT services are based on
the concept of utility computing.

104

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Pros and Cons of Cloud
Pros Cons
Lower upfront cost - Cloud/SaaS costs are classified as OPEX, reducing
the need for approval of large CAPEX Price increases - Due to a monthly pricing structure and a lack of control
Storage costs - Cloud storage costs continue to decrease. Extra storage can over the timing of updates and feature enhancements, customers can find
themselves subject to more frequent price increases.
be added with no hardware to purchase.
Premium support. - While basic level support is typically included in the
Support/maintenance - These costs may be included in monthly costs and monthly costs, premium level support is usually an added cost
not as an additional fee, making budgeting easier.

Policy - An organization's security is only as good as itis in-house


security policy. Even relatively secure cloud services are not a substitute
Secure environments - Cloud service vendors have a very high level of for a robust in-house security policy.
Industry - Industries with high security needs may need to work with
security and sophistication. SaaS vendors may be leveraging these platforms
vendors for data storage security and location needs.
to deliver their own services. Control - With cloud services, software and data can reside in the hands
of the vendor, not the customer. Some customers may not be able to
ascertain exactly where (location) data is stored
Faster setup - Cloud services can typically be deployed in a matter of days
(weeks/months for more customization) because hardware and software does Customization - Cloud services and software are typically configurable
not have to be installed onsite. but are not as customizable as some organizations may require.
On-demand - Cloud services are highly scalable. Organizations can simply
Integrations - Due to rapid release and update schedules of cloud
request more seats or storage and attain it rapidly.
services, existing, customized integrations with on-premises systems or
IT involvement - Cloud services typically require less IT involvement and other cloud solutions can become unstable during upgrades and feature
less in-house technical skill for deployment, updates and changes. Software rollouts.
updates and backups are done by the vendor and updates are done more
frequently than on-premises.
Internet connectivity - While Internet access makes cloud solutions
Mobile workers. - Cloud services require Internet connectivity. With wired
convenient, it's also their Achilles' heel. Cloud solutions require User
and wireless broadband become cheaper and available virtually anywhere, it
Access high-quality, reliable Internet access for workers to be productive
provides easy access for remote workers via multiple devices.
- whether remote or onsite. 105

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Pros and Cons of On-Premise
Pros Cons
Lower long-term cost - Over the long term, one-time license fees and
Extra costs - Because the in-house IT team supports and trains users for
annual maintenance fees for on-premises, perpetual license models are
on-premises software, training costs are significantly higher for this
generally lower than the cumulative recurring costs of SaaS software, with the model. On-premises software vendors typically charge a maintenance fee
break-even point typically occurring between two and three years after totaling 20 percent of the annual license fee.
purchase.
No monthly costs - On-premises deployments are typically structured in Hardware - On-premises deployments place more upfront costs on the
annual or multi-year plans, eliminating the need for monthly costs. customer. As the hardware and data center is owned by the customer,
the costs and associated risks (equipment failure) are mainly customer's
Virtualization - Owned hardware (servers) can be virtualized and shared for
responsibility and should be insured.
other internal needs at the owners discretion.
Customizable - Security can be highly customized to an individual Policy - An organization's security is only as good as it's in-house
organization's processes, requirements and regulatory requirements. security policy. For organizations with high security requirements, a solid
In-house - Knowledge of system and data reside solely in-house. May be security policy and in-house expertise will be needed.
preferable for companies with security needs where they do not want data Disaster recovery and backup - Disaster recovery and regularly
"shuffled"' over the Internet or want to restrict Internet access to their scheduled and secure backup plans are a necessity. With on-premises
systems, databases or applications entirely. deployments, this must be architected and implemented by the customer.
Customization - Vendors will typically work with customers to create
highly customized solutions. However, this can become expensive and
may inhibit or slow down the move to upgrades of other software/systems
in the future.
Control - On-premises deployments impart more control for the customer in Updates -On-premises solutions typically have a slower cycle to release
terms of timeline and rollout. The longer deployment timeframe adds more updates. The updates may require hardware and software changes and
time for knowledge transfer to in-house personnel. will involve heavy IT involvement to execute.
Longer implementation - On-premises deployments involve a larger
time commitment on the part of the customer. On-premises deployments
aren't simply turned on because of the requirements need for planning,
personnel, facilities, hardware, etc..
Speed - For organizations with extremely high bandwidth needs or large
Internet connectivity - On-premises systems can run without Internet
numbers of users accessing the same applications or data sets106
access. This is useful to keep mission-critical apps running - particularly in
simultaneously, on-premises solutions can be faster than their cloud
areas where Internet connectivity is not reliable.
counterparts.
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Cloud Computing Providers
Provider Description
This is a Force.com development platform. This provides a simple user interface and lets users log in,
Salesforce.com
build an app, and push it in the cloud (CRM applications)

AppScale The AppScale is an open source platform for App Engine of Google applications.

The AT&T allows access to virtual servers and manages the virtualization infrastructure. This
AT&T
virtualization infrastructure includes network, server and storage.
The FlexiScale offers a cloud computing platform that allows flexible, scalable and automated cloud
FlexiScale
infrastructure
The Google's App Engine lets the users build, run and maintain their applications on Google
Google
infrastructure.
The Microsoft Windows Azure is a cloud computing platform offering an environment to create cloud
Microsoft
apps and services.

RackSpace The RackSpace provides servers-on-demand via a cloud-driven platform of virtualized servers.

The Amazon EC2 (Elastic Compute Cloud) lets the users configure and control computing resources
Amazon EC2
while running them on Amazon environment.

Dell Bhoomi Integrated iPaaS platform from Dell

CloudHub is the platform as a service (PaaS) component of Anypoint Platform, providing a fully-
CloudHub managed, multi-tenanted, globally available, secure and highly available cloud platform for integration
and APIs
107

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Integration Platform as a Service


(iPaaS)
108
iPaaS
An integration platform as a service (iPaaS) solution provides capabilities to enable
subscribers / tenants to implement data, application, API and process integration projects
involving any combination of cloud-resident and on-premises endpoints. This is achieved by
developing, deploying, executing, managing and monitoring integration processes/flows that
connect multiple endpoints so that they can work together
iPaaS capabilities must include:
• Communication protocol connectors such as FTP, HTTP, Advanced Message Queueing
Protocol (AMQP) and others
• Application connectors / adapters for SaaS and on-premises packaged applications
• Data formats such as XML, JavaScript Object Notation (JSON) and others
• Data standards such as Electronic Data Interchange for Administration, Commerce and
Transportation (EDIFACT), Health Level Seven (HL7), SWIFT and others
• Data mapping and transformation
• Data quality
• Routing and orchestration
• Integration flow development and life cycle management tools
• Integration flow operational monitoring and management

109

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


iPaaS

110

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

AWS LAMBDA
111
AWS Lambda
AWS Lambda is a responsive cloud service that inspects actions within the application and
responds by deploying the user-defined codes, known as functions. It automatically
manages the compute resources across multiple availability zones and scales them when
new actions are triggered.
AWS Lambda supports the code written in Java, Python and Node.js, and the service can
launch processes in languages supported by Amazon Linux (includes Bash, Go & Ruby).
AWS Lambda is an event-driven, serverless computing platform as a part of the Amazon
Web Services. It is a computing service that runs code in response to events and
automatically manages the computing resources required by that code.

The purpose of Lambda, as compared to AWS EC2, is to simplify building smaller, on-
demand applications that are responsive to events and new information.
Following are some recommended tips while using AWS Lambda.
• Write Lambda function code in a stateless style.
• Never declare any function variable outside the scope of the handler.
• Set of +rx permissions on files in the uploaded ZIP to ensure Lambda can execute
code.
• Delete old Lambda functions when no longer required 112

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


AWS Lambda Benefits
Following are some of the benefits of using Lambda tasks −
• Lambda tasks need not to be registered like Amazon SWF activity types.
• Existing Lambda functions that you’ve already defined in workflows.
• Lambda functions are called directly by Amazon SWF; there is no need design a
program to implement and execute them.
• Lambda provides us the metrics and logs for tracking function executions.

113

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


AWS Lambda Limits
Throttle Limit
The throttle limit is 100 concurrent Lambda function executions per account and is
applied to the total concurrent executions across all functions within a same region.
The formula to calculate the number of concurrent executions for a function = (average
duration of the function execution) X (number of requests or events processed by AWS
Lambda).
When throttle limit is reached, then it returns a throttling error having an error code
429. After 15-30 minute you can start work again. The throttle limit can be increased by
contacting AWS support center.

114

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


AWS Lambda Limits
Resources Limit
The following table shows the list of resources limits for a Lambda function.

Resource Default Limit


Ephemeral disk capacity ("/tmp" space) 512 MB
Number of file descriptors 1,024
Number of processes and threads (combined total) 1,024
Maximum execution duration per request 300 seconds
Invoke request body payload size 6 MB
Invoke response body payload size 6 MB

115

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


AWS Lambda Limits
Service Limit
The following table shows the list of services limits for deploying a Lambda function

Item Default Limit


Lambda function deployment package size (.zip/.jar file) 50 MB
Size of code/dependencies that you can zip into a deployment 250 MB
package (uncompressed zip/jar size)
Total size of all the deployment packages that can be uploaded per 1.5 GB
region
Number of unique event sources of the Scheduled Event source 50
type per account
Number of unique Lambda functions you can connect to each 5
Scheduled Event

116

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Loan Broker Use Case


117
Loan Broker Use Case
• Loan Broker – Requirements & Design
• Obtaining Loan Quote
• Obtaining Loan Quote using Loan Broker
• Loan broker coordinates with external systems for lowest quote
• Loan Broker decouples from external system using Enterprise Service Bus
• Configuration – camelcontext.xml, Configuration Elements
• Inbuilt Components - Data Mapper, JDBC Connector, Routing, Error Handling
• Custom Transformer
• Deployment Options: Standalone / Embedded
• Demo

118

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case -
Requirements
• When shopping for a loan, a customer usually calls several banks to find the deal with
the best possible interest rate
• Each bank asks the customer for his or her social security number, the amount of the
loan and the desired term , i.e. the number of months until the loan has to be paid off
• Each bank then investigates the customer's credit background, usually by contacting a
credit agency
• Based on the requested terms and the customer's credit history, the bank responds with
an interest rate quote to the consumer (or declines thankfully)
• Once the customer has received quotes from all banks, he or she can then select the
best offer, i.e. the lowest interest rate

119

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case – High
Level Process Flow
Business Problem
• Because contacting multiple banks with a loan quote request is a tedious task, loan
brokers offer this service to consumers

Solution
• A loan broker is typically not affiliated with any one bank but has access to many lending
institutions
• The broker gathers the customer data once and contacts the credit agency to obtain the
customer's credit history
• Based on the credit score and history, the broker presents the request to a number of
banks that are best suited to meet the customer’s criteria.
• The broker gathers the resulting quotes from the banks and selects the best offer (i.e.
the lowest interest rate) to pass back to the consumer.

Insurance
Customer Insurance
Insurance broker collates
requests Broker
broker sends the quotes,
insurance requests
customer info provides the
broker for Insurance Org
to get profile customer the
quote for quotes
lowest quote
120

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case –
Solution Design
5. Provide customer
1. Customer lowest quote
requests for lowest Credit
quote Service(
Bean)

3. Get eligible Banks


for requesting quote

Insurance Broker
4. Get Bank
2. Get Customer
Quote
Profile
Credit
Agency( Bank Bank
JMS) 1(JMS Bank 3(JMS
service) 2(JMS service)
service)
121

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case –
Solution Realization

Bank Bank 1
Http Services
Client
Bank 2
Bank
1. Receive Agency
Loan
Request 3. Get Banks List
Loan
Broker Bank 3

2. Get Credit 4. Get Quote


5. Determine Initiate Profile
Lowest Quote Service
Orchestration

Enterprise Service Bus

122

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case –
Solution Realization
• The request-response [*HTTP Inbound Endpoint*] in this flow receives an end user
request.
• Next, the Body to Parameter Map Transformer converts the data format of the message
payload from HTTP body data to a Java map. The Loan Broker application only
processes Java message payloads.
• Then, Camel employs a content-based router to direct the message for further
processing. The routes each message to one of two processing pathways according to
its payload contents.
o If the message payload contains a complete request (i.e. the borrower’s name and
SSN, and the amount and the term of the loan), the choice flow control passes the
message to the create customer request [*Expression Component*].
o If the message payload is an incomplete request, the choice flow control passes the
message to the set error messageexpression component. This component sets the
payload of the message to read Error: incomplete request. Camel processes the
message no further. Instead, it responds to the end user with the error message.
• The create customer request component uses expressions to extract data from the
message payload. It uses the data to create a new Java object with three values:
o the Customer, which identifies both the borrower’s name and SSN
o one Integer, which identifies the amount of the loan
o a second Integer, which identifies the loan repayment term 123

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case –
Solution Realization
• With a new Customer Quote Request object in its payload, the message encounters its
first [*Message Enricher*]. Throughout this flow, Camel enriches messages with data
rather than changing the payload contents. By enriching a message, Camel preserves
the payload content so that other elements in the application can access the original
data.
• As with its predecessor, the Enrich with Banks enricher uses a flow reference component
to invoke a subflow and acquire data. In this case, instead of adding a credit score,
Camel uses the result of the Lookup Banks subflow to add a list of banks to the
message payload.
• One by one, this iterative processor fetches data to populate each item on the list.
• To fetch these data, the flow reference component first invokes the to acquire a quote
from a bank.
• Then, the message enricher adds the quote to the list variable.
• For each continues to invoke, then enrich, until it has acquired a quote from each bank
on the list of banks to customers.

124

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Loan Broker Use Case –
Solution Realization
This example shows how to use Camel to
implement the EIP's loan broker example, from the
EIP book
(http://www.enterpriseintegrationpatterns.com/Syst
emManagementExample.html).

The example use web services for exchanging


messages between the client, credit agency, and
the banks.

Build
You will need to compile this example first:
mvn compile

Run
mvn exec:java -PWS.LoanBroker
mvn exec:java -PWS.Client

125

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

XYZ Media Use Case


126
XYZ Media Use Case
Understanding
• Currently applications are integrating using point to point using SOAP / Rest
Services
• Difficulty in Managing, Monitoring and extending integrations due to point to point
integrations
• Data related issues are not handled properly at application level (programming
efforts required)
• Exception handling and logging are maintained at application level. No centralized
mechanism.

Overview
• Recommends a Middleware solution which is cost effective, maintainable and future
ready
• Utilizes existing Service s exposed by the existing application can be consumed in
middleware

Scope
• A total of 08 interfaces have been identified for the current scope between PO,
ECC, CRM, SAP-BW and iPrice
• Using Apache Camel as the Middleware solution for integration between systems 127

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


XYZ Media Use Case
Objective
• Streamline data exchange between applications to avoiding multiple point-to-point
connections
• Enable data and protocol transformation between data providers and consumers on a
native format
• Enable incremental adoption of a Service Oriented Architecture (SOA) with minimal
disruption to existing business operations
• Enable reliable, asynchronous messaging to build highly available applications
• Enable real time message exchange to support real time provisioning and de-
provisioning of services
• Apply standard and consistent authentication, security and monitoring policies across
applications

128

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


XYZ Media Use Case

AS - IS TO - BE

CRM iPrice

Middleware
(Apache Connectivity Services

Camel) Rest /SOAP FTP / BATCH / DB

Component Services
Routing Orchestration

Business Services

Provisioning Mapping

ECC SAP-BW

129

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


XYZ Media Use Case

Sl.No Interface Sender Sender Adapter Receiver Receiver Interface


System Adapter Type
1 SFDC session ID PO File ECC RPC Async
2 Customer Master data ECC SOAP/REST CRM SOAP Async
3 Order creation in SAP CRM SOAP ECC Idoc/SOAP Async
4 Order creation response ECC SOAP CRM SOAP Async
5 Order data for REV sys ECC SOAP CRM SOAP Async
6 Historical Published Ad BW RFC/File/REST iPrice FTP Async
data
7 Customer score (Sync) CRM SOAP/REST iPrice SOAP Sync
8 Daily Published Ads data BW RPC/File/REST CRM SOAP Async

130

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Different ESB Comparison


131
ESB Comparison

Jboss FUSE Mule ESB WebSphere ESB Oracle ESB

Apache ActiveMQ - A fast, AMQP (Advanced Message WebSphere MQ - IBM’s Oracle Message Broker - A
open source message broker Queuing Protocol): Support is implementation of the JMS JMS-compliant API supports
that supports JMS based on the RabbitMQ Java interfaces AQ, IBM MQSeries, TIBCo
Client Rendezvous, and more
Apache Camel - An open Routing/EIPs - Content-based
source framework that provides Routers - MuleSoft uses routing and other enterprise Routing Service - SOA style
implementations of tried and routers to split, combine, integration patterns can be routing services allows for
true EIPS (Enterprise reorder, evaluate, and implemented via the use of routing rules to be defined and
Integration Patterns). broadcast messages XSLT published with a WSDL
Apache CFX - An open source Anypoint Connectors - Pre- WebSphere Adapters - Pre- Integration Adapters - A set
web services framework, which built protocol, database, built protocol, database, of JCA adapters available for
provides for communication transport, and database transport, and database download.
using various standards such connectors. connectors
ESB Server - The runtime
as JAX-WS and JAX-RS
Mule Runtime Engine - The WebSphere Application server that listens to topics for
Apache Karaf - An OSGI heart of the MuleSoft Anypoint Server - The runtime of updates
runtime container for deploying platform. Deployable in the WebSphere ESB is built on top
ESB Control - Allows
applications cloud or on premise of WAS
configuration changes to be
Fabric8 - An orchestration tool Mule Runtime Manager - Administrative Console - A made in real time
for large middleware Allows for the deployment, browser-based interface that
deployments monitoring, and that allows to monitor, update,
troubleshooting of Mule start and stop applications,
instances services, and resources
running on WebSphere ESB

132

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Questions

133

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

S-ar putea să vă placă și