lec 12 client server

Upload: zaheer-bk

Post on 22-Feb-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/24/2019 Lec 12 Client Server

    1/35

    The Client/Server DatabaseThe Client/Server DatabaseEnvironmentEnvironment

    CS263 Lecture 12

  • 7/24/2019 Lec 12 Client Server

    2/35

    Client/Server systemsClient/Server systems

    Operate in a networked environment

    Processing of an application distributed between frontendclients and backend servers

    !enerall" t#e client process re$uires some resource% w#ic# t#eserver provides to t#e client

    Clients and servers can reside in t#e same computer% or t#e" canbe on different computers t#at are networked toget#er% usuall"&

    Client ' (orkstation )usuall" a PC* t#at re$uests and uses aservice

    Server ' Computer )PC+mini+mainframe* t#at provides aservice, -or ./0S% server is a database server

  • 7/24/2019 Lec 12 Client Server

    3/35

    Three components ofThree components of

    application logicapplication logic 1, nput ' output or presentation logic component '

    responsible for formatting and presenting data on t#e users

    screen )or ot#er output device* and managing user input from

    ke"board )or ot#er input device* 2, Processing component logic ' #andles data processing

    logic )validation and identification of processing errors*%

    business rules logic% and data management logic )identifies

    t#e data necessar" for processing t#e transaction or $uer"* 3, Storage component logic ' responsible for data storage and

    retrieval from t#e p#"sical storage devices ' ./0S activities

    occur #ere

  • 7/24/2019 Lec 12 Client Server

    4/35

    Client/Server architecturesClient/Server architectures

    -ile Server rc#itecture

    .atabase Server rc#itecture

    4#reetier rc#itecture

    Client does

    extensive processing

    Client does little

    processing

  • 7/24/2019 Lec 12 Client Server

    5/35

    File server architectureFile server architecture

    4#e first client+server arc#itectures developed

    ll processing is done at t#e PC t#at re$uested t#e data% ,e, t#eclient #andles t#e presentation logic% t#e processing logic and muc#

    of t#e storage logic file server is a device t#at manages file operations and is s#ared b"

    eac# of t#e client PCs attac#ed to t#e L5

    ac# file server acts as an additional #ard disk for eac# of t#e clientPCs

    ac# PC ma" be called a -4 CL54 )most processing occurs ont#e client*

    ntire files are transferred from t#e server to t#e client forprocessing,

  • 7/24/2019 Lec 12 Client Server

    6/35

    Three problems with fileThree problems with file

    server architectureserver architecture 1, 7uge amount of data transfer on t#e network% because

    w#en client wants to access data w#ole table)s* transferred

    to PC ' so server is doing ver" little work% network is

    transferring large blocks of data and client is bus" wit#

    e8tensive data manipulation

    2, ac# client is aut#orised to use t#e ./0S w#en a

    database application program runs on t#at PC, 4#us t#ere

    is one database but man" concurrentl" running copies oft#e ./0S )one on eac# active PC* ' so #eav" resource

    demand on clients

  • 7/24/2019 Lec 12 Client Server

    7/35

    Three problems with fileThree problems with file

    server architectureserver architecture 3, 4#e ./0S cop" in eac# client PC must manage t#e

    s#ared database integrit"% ,e, Client ./0Ss must

    recogni9e s#ared locks% integrit" c#ecks% etc, So

    programmers must be sop#isticated to recognise various

    subtle conditions t#at can arise in a multipleuser database

    environment% as #ave to understand overview of

    concurrenc"% recover" and securit" controls and build

    t#ese into t#eir application

  • 7/24/2019 Lec 12 Client Server

    8/35

    -ile Server rc#itecture

    AT CLIENTAT CLIENT

  • 7/24/2019 Lec 12 Client Server

    9/35

    Database server architecturesDatabase server architectures fter t#e fileserver approac# came twotiered approac#es Client is responsible for managing user interface% +O processing logic%

    data processing logic and some business rules logic )frontend programs*

    .atabase server performs all data storage and access processing )backend functions* ' ./0S is onl" on server

    dvantages include&Clients do not #ave to be as powerful% onl" t#edatabase server re$uires processing power ade$uate to #andle t#edatabase ' t#erefore t#e server can be tuned to optimise data processing

    performance

    !reatl" reduces data traffic on t#e network% as onl" t#ose records )rat#er

    t#an tables* t#at matc# t#e re$uested criteria are transmitted to t#e client mproved data integrit" since it is all processed centrall"

  • 7/24/2019 Lec 12 Client Server

    10/35

    Stored proceduresStored procedures

    4#ese are modules of code t#at implement applicationlogic% w#ic# are included on t#e database server, 4#e" #avet#e following advantages&

    Performance improves for compiled S:L statements ;educed network traffic as processing moves from t#e

    client to t#e server

    mproved securit" if t#e stored procedure is accessed rat#er

    t#an t#e data and code being moved to t#e server mproved data integrit" as multiple applications access t#e

    same stored procedure

    4#inner clients )and a fatter database server*

  • 7/24/2019 Lec 12 Client Server

    11/35

    Stored proceduresStored procedures

    7ave some disadvantages&

    (riting stored procedures takes more time t#an using

    somet#ing like

  • 7/24/2019 Lec 12 Client Server

    12/35

    Database server architecture

    ThinnThinnerer

    clientclient

    ss

    DBMS onlyDBMS only

    on serveron server

  • 7/24/2019 Lec 12 Client Server

    13/35

    Three-tier architecturesThree-tier architectures n general% t#ese include anot#er server la"er in addition to t#e client and database

    server

    4#is additional server ma" be used for different purposes

    Often application programs reside on t#e additional server )t#e application server*

    Or additional server ma" #old a local database w#ilst anot#er server #olds t#e

    enterprise database Often a t#in client PC =ust for user interface and a little application processing,

    Limited or no data storage )sometimes no #ard drive*

  • 7/24/2019 Lec 12 Client Server

    14/35

    Three-tier architecture

    ThinnestThinnestclientsclients

    Business rules onBusiness rules on

    separate serverseparate server

    DBMS only onDBMS only on

    DB serverDB server

  • 7/24/2019 Lec 12 Client Server

    15/35

    Advantages of three-tierAdvantages of three-tier

    architecturesarchitectures Scalabilit" ' middle tier can be used to reduce t#e load on a

    database sever b" using a transaction processing )4P* monitor toreduce t#e number of connections to a server% and additional

    application servers can be added to distribute applicationprocessing

    4ec#nological fle8ibilit" ' easier to c#ange ./0S engines 'middle tier can be moved to a different platform, Simplifiedpresentation interfaces make it easier to implement newinterfaces

    Longterm cost reduction ' use of offt#es#elf components orservices in t#e middle tier can reduce costs% as can substitutionof modules wit#in an application rat#er t#an a w#ole application

  • 7/24/2019 Lec 12 Client Server

    16/35

    Advantages of three-tierAdvantages of three-tier

    architecturesarchitectures /etter matc# of s"stems to business needs ' new modules

    can be built to support specific business needs rat#er t#an

    building more general% complete applications

    mproved customer service ' multiple interfaces on

    different clients can access t#e same business process

    Competitive advantage ' abilit" to react to business

    c#anges $uickl" b" c#anging small modules of code rat#er

    t#an entire applications

  • 7/24/2019 Lec 12 Client Server

    17/35

    Challenges of three-tierChallenges of three-tier

    architecturesarchitectures 7ig# s#ortterm costs ' presentation component must be split

    from process component ' t#is re$uires more programming

    4ools% training and e8perience' currentl" lack of development

    tools and training programmes% and people e8perienced in t#etec#nolog"

    ncompatible standards ' few standards "et proposed

    Lack of compatible enduser tools ' man" enduser tools suc#

    as spreads#eets and report generators do not "et work t#roug#middletier services )see later discussion on middleware*

  • 7/24/2019 Lec 12 Client Server

    18/35

    Application partitioningApplication partitioning

    Placing portions of t#e application code in differentlocations )client vs, server* -4; it is written, 7as t#efollowing advantages&

    mproved performance mproved interoperabilit"

    /alanced workloads across t#e tiers

    OO development ver" suitable for t#is

    5ecessar" in t#e (eb environment% in order to ac#ievedesired performance in an unpredictable distributedenvironment

  • 7/24/2019 Lec 12 Client Server

    19/35

    arallel computerarallel computer

    architecturesarchitectures 4#e abilit" to #andle #ig# transaction volumes% comple8

    $ueries and new data t"pes #as proven problematic in man"

    uniprocessor environments, /ut ;./0S and S:L lend

    t#emselves to a parallel environment in 2 wa"s )see following-ig,*&

    1, n most $ueries% S:L acts as a nonprocedural set

    processing language ' t#is means t#at $ueries can be divided

    into parts% eac# of w#ic# can t#en be run on a differentprocessor simultaneousl"

    2, 0ultiple $ueries can be run in parallel on parallel

    processors

  • 7/24/2019 Lec 12 Client Server

    20/35

    !uery processing with parallel!uery processing with parallel

    processorsprocessors

    Parallel transactions

    Parallel $uer"

  • 7/24/2019 Lec 12 Client Server

    21/35

    arallel computerarallel computer

    architecturesarchitectures 4ig#tl" Coupled multiprocessor s"stems #ave a common

    s#ared memor" );0* among all processors% and are oftencalled S"mmetric 0ultiprocessing )S0P* arc#itectures,

    7ave some advantages& Single cop" of t#e operating s"stem resides in t#e s#ared

    memor"

    /ottlenecks are lessened compared to uniprocessor s"stemsbecause all processors s#are all tasks

    >seful for situations w#ere data must remain in memor"during processing to ac#ieve t#e desired performance level 'but potential problems of contention for t#e s#ared memor"

  • 7/24/2019 Lec 12 Client Server

    22/35

    arallel computerarallel computer

    architecturesarchitectures Loosel" Coupled arc#itectures% also called 0assivel" Parallel

    Processing )0PP* are w#ere eac# CP> #as its own ;0

    space

    ;e$uire a cop" of t#e operating s"stem to be resident in eac#dedicated memor"

    Less problems wit# memor" contention% allows more

    scalabilit" ' easier to add nodes incrementall" t#an S0P

    /asicall" applications t#at #ave large tasks t#at can be dividedup and worked on simultaneousl" t#at are best suited to 0PP

    arc#itectures% rat#er t#an applications t#at can benefit from t#e

    use of s#ared memor"

  • 7/24/2019 Lec 12 Client Server

    23/35

    arallel Computer Architecturesarallel Computer Architectures

    4ig#tl"coupled ' CP>s s#are

    common memor" space

    Loosel"coupled ' CP>s eac#

    #ave t#eir own memor" space

  • 7/24/2019 Lec 12 Client Server

    24/35

    "iddleware"iddleware

    Software w#ic# allows an application to interoperateinteroperatewit#ot#er software% wit#out re$uiring t#e user to understand andcode t#e lowlevel operations re$uired to ac#ieve

    interoperabilit"(it# S"nc#ronous s"stems% t#e re$uesting s"stem waits for a

    response to t#e re$uest in real time

    s"nc#ronous s"stems send a re$uest but do not wait for aresponse in real time ' t#e response is accepted w#enever itis received ,

    The gluegluethat holds client/server applications together

  • 7/24/2019 Lec 12 Client Server

    25/35

    Si# types of middlewareSi# types of middleware 1, s"nc#ronous ;emote Procedure Calls );PC* client makes calls to

    procedures running on remote computers but does not wait for a response,

    f connection is lost% client must reestablis# t#e connection and sendre$uest again, 7ig# scalabilit" but low recover"% largel" replaced b" t"pe2

    2, S"nc#ronous ;PC ' distributed program using t#is ma" call servicesavailable on different computers ' makes it possible to ac#ieve t#is

    wit#out undertaking detailed coding )e,g, ;0 in ?ava* 3, Publis#+Subscribe ' often called pus# tec#nolog"% #ere server monitors

    activit" and sends information to client w#en available, t isas"nc#ronous% t#e clients )subscribers* perform ot#er activities betweennotifications from t#e server, >seful for monitoring situations w#ereactions need to be taken w#en particular events occur,

  • 7/24/2019 Lec 12 Client Server

    26/35

    Si# types of middlewareSi# types of middleware

    @, 0essageOriented 0iddleware )0O0* as"nc#ronous '

    sends messages t#at are collected and stored until t#e" are

    acted upon% w#ile t#e client continues wit# ot#er processing,

    A, Ob=ect ;e$uest /roker )O;/* ob=ectoriented

    management of communications between clients and

    servers, O;/ tracks t#e location of eac# ob=ect and routes

    re$uests to eac# ob=ect,

    6, S:Loriented .ata ccess middleware betweenapplications and database servers, 7as t#e capabilit" to

    translate generic S:L into t#e S:L specific to t#e database

  • 7/24/2019 Lec 12 Client Server

    27/35

    Database middlewareDatabase middleware

    O./C ' Open .atabase Connectivit" most ./ vendors

    support t#is

    OL./ 0icrosoft en#ancement of O./C

    ?./C ' ?ava .atabase Connectivit" Special ?ava classest#at allow ?ava applications+applets to connect to databases

    CO;/ ' Common Ob=ect ;e$uest /roker rc#itecture '

    specification of ob=ectoriented middleware

    .CO0 ' 0icrosofts version of CO;/ ' not as robust as

    CO;/ over multiple platforms

  • 7/24/2019 Lec 12 Client Server

    28/35

    Client/Server securityClient/Server security

    5etwork environment #as comple8 securit" issues, 5etworkssusceptible to breac#es of securit" t#roug# eavesdropping%unaut#orised connections or unaut#orised retrieval of packetsof information flowing round t#e network, Specific securit"issues include&

    S"stemlevel password securit" ' user names and passwordsfor allowing access to t#e s"stem, Password managementutilities

    .atabaselevel password securit" for determining accessprivileges to tablesB read+update+insert+delete privileges

    Secure client+server communication via encr"ption ' butencr"ption can negativel" affect performance

  • 7/24/2019 Lec 12 Client Server

    29/35

    Database access from clientDatabase access from client

    applicationsapplications Partitioning t#e environment to create a two% t#ree or ntier

    arc#itecture means t#at decisions must be made about t#e

    placement of t#e processing logic

    n eac# case% storage logic )t#e database engine* is #andled

    b" t#e server% and presentation logic is #andled b" t#e

    client

    Part a* of t#e following -ig, depicts some possible 2tier

    s"stems% placing t#e processing logic on t#e client )fatclient*% on t#e server )t#in client* or partitioned across bot#

    t#e server and t#e client )a distributed environment*

  • 7/24/2019 Lec 12 Client Server

    30/35

    Database access from clientDatabase access from client

    applicationsapplications Part b* of t#e following -ig, .epicts a t"pical 3tier

    arc#itecture and an ntier arc#itecture

    Some processing logic could be placed on t#e client if

    desired

    /ut a t"pical client in a (eb enabled environment will be a

    t#in client% using a browser for its presentation logic

    4#e middle tiers are t"picall" coded in a portable language

    suc# as ?ava

    i l i di ib i

  • 7/24/2019 Lec 12 Client Server

    31/35

    rocessing logic distributionsrocessing logic distributions

    a* 2tier

    b) 3 and ntier

    Processing logic could be

    at client% server% or bot#

    Processing logic will be at

    application server or (eb

    server

  • 7/24/2019 Lec 12 Client Server

    32/35

    !uery-by-e#ample $!%E&!uery-by-e#ample $!%E&

    s t#e most widel" available directmanipulation database

    $uer" language

    !rap#ical approac#% bot# data retrieval and data

    modification can be done b" entering ke"words% constants

    and e8ample data into t#e cells of a table la"out

    vailable in 0S ccess 0S ccess translates :/ to

    S:L and vice versa

    >seful for enduser database programming

    !ood for ad #oc processing and protot"ping ' but lacks

    fle8ibilit" of directl" coding in S:L

  • 7/24/2019 Lec 12 Client Server

    33/35

    'sing (D%C to lin) e#ternal databases'sing (D%C to lin) e#ternal databases

    stored on a database serverstored on a database server

    Open .atabase Connectivit" )O./C* is an P t#at provides acommon language for application programs to access and processS:L databases independent of t#e particular ;./0S t#at isaccessed

    ;e$uired parameters&

    O./C driver needed

    /ackend server name

    .atabase name

    >ser id and password

  • 7/24/2019 Lec 12 Client Server

    34/35

    'sing (D%C to lin) e#ternal databases'sing (D%C to lin) e#ternal databases

    stored on a database serverstored on a database server

    -ollowing -ig, S#ows generic O./C arc#itecture

    Client application re$uests t#at a connection is establis#ed

    wit# a data source

    .river manager identifies appropriate O./C driver to use

    .river selected will process t#e re$uests received from t#e

    client and submit $ueries to t#e ;./0S in t#e re$uired

    version of S:L

    ?ava .atabase Connectivit" )?./C* is similar to O./C '

    built specificall" for ?ava applications

    (D%C Architecture(D%C Architecture

  • 7/24/2019 Lec 12 Client Server

    35/35

    (D%C Architecture(D%C Architecture

    Each DBMS has its own ODBC-compliant driver

    Client does not need

    to know anything

    ao!t the DBMS

    "pplication #rogram

    $nter%ace &"#$' providescommon inter%ace to all

    DBMSs