Programming For Performance
Programming For Performance
server
Problems
A client servermodel allows different processes to communicate
remotely However developing a client serverappis tedious
It requires Designing a specificprotocol or adoptingandadapting
to an existing one
Managingconnectionsand streams on bothsides
Implementing a protocolandhandlingerrors
Objective Wewant the
luxury to invokeremoteservices as if
theywere local Thisparadigmhides all theprogramminghastes
and details
Change the perspective fromseeingconnection of
as exchanges
messages to invokingfunctionsremotely
We cave
taking communication into a higherlevel of
abstraction
Having a new layer ontop ofthe Client ServerModel
Hiding the gap between CSS
o Id's not revolution Just build ontopof CISModel
Increase developer productivity nonfunctional
Promote softwareintegrationfar
public interfacecalculator
add floats floating
floatsubtract
float
MFFintetfaa floats
are
floating
andabstract default
nterfa h
GO
Java Python
Languageagnostic technologies
Mostfamous CORBA commonobjectRequestBrokerArchitecture
it uses an underlying protocol II OP
CORBACreated IDL which is a naturalway to define
services
Aslong as client serverfollow thesameprotocol no
matterthe languagethey'rewritten in theycancommunicate
CORBA uses IDL Kempiler idldjaver to generatestub skeleton
usingIDLcompiler written in IPL using
taps IDL camping
IPL 2 Java FDL python
d Favaskeleton
Tvastab pythnstab pythonshel
botharegeneratedforflexibility
XML SOAP
XML extensiblemarkuplanguage
XML SOAP Thistechnology allowsdifferent languages to
communicate using xox to serializethedata
It follows the HTTPprotocol since it wasthereandis capable
hence it's a webservice
of handlingerrors
toggfMYesitfaeservice API
XML Definesdataformat serialization
Definesformatofmessagesexchangedbetter cos
polyglot
ftp
Saket API
HTTP header
I
I HTTPheader
marshaledresults
isused to supporttheXMLIsoAP
makesclass remotelyinrobable technology
Providercode
publishingcalculator
object
undertheURL
REISfeelwebsories
Rest is not a technology does not specifyprotocol API
it is an architectural style set
ofconstraints rules
it is for data driven apps
Nonfunctional requirements ofREST
Performance measuredby response time and numberof
transactions processedpersecond
Scalability preserve performance even whenloadincreases
Simplicity RESTis simple
Rodifiability Allowingthe modificationofresource
Portability
Reliability
Functional requirements
Client server Architecture
stateleness eachclient request a clientto a
from
server must contain all the informationneeded to
understand andprocessthe request withoutrelying
on
any stored content on the server
Cachability usingcaching so that futurerequestsfor
the same resource can be served morequickly
Self descriptivemessages each message response
request should contain all the necessaryinformation
fortherecipienttounderstandanprocessit
HATEOS constraintof RESTarchitecture thatallows
to access resources as dynamiclinks embedded
in the response
Operations are known GET POST PATCH POT DELETE
tD Name
ofcollections isn't enough
to thealttebutes
youneed know
POST X V Ofthedaba
PATCH V x under whichfarmatstrouldit
PUT V X be JSON xM4 leavesitopen
DELETE V X
OpenAII
OpenAPI is an API specification language written in
JSON
API is generatedusing thedependency to build gradle
whichwould help us generatetheopenAPIdefinition
This car calculator OpenAPI definition
Then we use swaggertoal that takesOpenAPI definition
and generatesthe client Spk whichcontainsthe stub
barourcasestudes it's
the OpenAPI definition
client