CS330 &) - - PDF document

cs330
SMART_READER_LITE
LIVE PREVIEW

CS330 &) - - PDF document

The Big Picture CS330 &) &'(


slide-1
SLIDE 1
  • CS330
  • 2

The Big Picture

  • !
  • !

" "# $ % "

  • %

! &'(

  • &)

& !

Overview

!" ""

4

Layers and Tiers

#$ %! &$ # # '$ '&% %#(' ((& #%) #( & # '$ #*+#',#' !-%' #& '((( ,! '#!'# .#('&

Client Application Logic Resource Manager Presentation layer Business rules Business objects Client Server Database Client Business processes Persistent storage 5

A Game of Boxes and Arrows

  • (,%&
  • $

($$%&

  • (,'

)%'( '&$ (''#&

  • (,$)

+-'( ''& (, '#&

  • (,#(%

,$'' ##(%#'& %%%'(&

  • "'#(

%,(%''#$ %''%& /('' #'$'#$$&

There is no problem in system design that cannot be solved by adding a level of indirection. There is no performance problem that cannot be solved by removing a level of indirection.

6

Top-Down Design

slide-2
SLIDE 2
  • *

7

Top-Down design

  • !

"

  • #

$

  • 8

Bottom-Up Design

  • ('#%

(',& '$' (#'$&

  • '

$' &/%' # $&

  • $'

('# ','( '&

  • %$''

'''$ ''!' %('# #'$ '(&

Legacy systems New application Legacy application

9

Bottom-Up Design

%

  • %
  • 10

Bottom-Up Design

  • &&
  • ! &
  • #
  • %'
  • %

11

One Tier: Fully Centralized

  • #'

#( &

  • #'(
  • $

%%%%#! '!#)

  • %',$

%$+!# $-

  • *'##'

#

  • '#(#

*'((# ($&

Server

12

Two Tier: Client/Server

  • (

$%$(!

  • &!

'!#)

  • ''&
  • #$&
  • '%

+#%-& %! %'&$ '#( %'# #&

  • #

)#& #$ % &

Server

slide-3
SLIDE 3
  • +

13

APIs in Client/Server

  • ''%!
  • ''%%+$!#!

!-

  • ''*%%''%
  • "

"

  • "
  • "
  • "
  • "()

" " " "

14

Technical Aspects Of Two Tier

  • '!#"#)
  • '!#%%%1'$
  • 2$!$+3
  • !'##''(*'(

##

  • "!#'%%$##

%!$

  • 4'!#)
  • #
  • 5'6 +''-&

$'$&

  • 7%'&%!%('$&
  • ''($'%%$%

#%&

15

The Main Limitation of Client/Server

  • (%'#

$# %'&

  • (

(%$# $#$# '$

  • 8%%+%$

'#(' % '&-&

  • (!'

$91 Server A Server B

  • #$!)
  • '#':

$(

  • 7(#
  • %#

+#%-

16

Three Tier: Middleware

% '& '(' #'!#% '% '#

17

Middleware

  • ''$;!%

'($' %&

  • '''%

(## '#&

  • <'#''$

)

  • %'#%

('#(% %

  • !'

'#

  • %%1

%'# !#'

  • %#

#'## &

Middleware or global application logic clients Local resource managers Local application logic

Server A Server B

middleware

18

Technical Aspects of Middleware

'%''$)

(%%#'')

+''$- +''$-

*+''$! 9- %$'!( $%$$'( !'%%!'' %$''#$# +%%-&

''$')

'! ,%$ '!%

slide-4
SLIDE 4
  • ,

19

A three tier middleware based system ...

External clients connecting logic control user logic internal clients 2 tier systems Resource managers wrappers

middleware

Resource manager 2 tier system middleware system External client

20

N-Tier Architectures

  • 71

%#!

  • ''%2(

'% 5!6$ $'% ''$% ## 2(

  • *%"

*%% +,

21

)-,.-., /).*

  • *
  • N-tier In reality

22

Blocking or Synchronous Interaction

  • '%

(# " .(( 516) .!# . .' !&

  • $

(&( .( '!(5!6

  • Call

Receive Response Answer idle time

4'!#' *)

!' #((% % 4%%'%' % % ,

client server

23

Overhead of Synchronism

  • 7'

($' !&

  • #

,!& $( !

  • 0!

% #* *

  • !%
  • ''
  • "

.,% ',# %#&

request() do with answer receive process return session duration request() do with answer receive process return Context is lost Needs to be restarted!!

24

Failures In Synchronous Calls

  • %!%

,&

  • %%'(%

3#'

  • %%%3

((%9+!

  • .
  • %%%9

((%='%%

  • %%%=

((%> (( %'+'#?-

  • 2(%%'#

$'?

  • '#$%

(&% %! %$ #&

request() do with answer receive process return 1 2 3 4 request() do with answer timeout try again do with answer receive process return 1 2 3 receive process return 2’ 3’

slide-5
SLIDE 5
  • 25

Two Solutions

774"/ 0"! '''$ %!' (% '$( '( )

"!' '(# "@7/7/"7/7

  • #

' ##' $! '''&

  • $%)
  • 71(#!
  • .

26

Message Queuing

  • (.#

, )

  • "(''#)

'%#. ('%%' +!'%%A- '%'#$

  • '#'

'('' '

  • ($
  • $

, ($ # do with answer do with answer request() request() receive process return queue queue

Overview

!" ""

Internet Concepts

/!!$ ," 3&B!&3&3 !4! "%.0"!

  • Uniform Resource Identifiers

%#'%

  • (#)
  • ',&
  • #&=
  • &;#

,) )00$$$&&$&'0C'((0',& )$(D(&

Structure of URIs

)00$$$&&$&'0C'((0',& )

  • 7#+-
  • 7%+$$$&&$&'-
  • 7%+C'((0',&-

(%

slide-6
SLIDE 6
  • HTTP Overview

),% 4!'(<3EEB 0"!)

.'

,)7&

"!'

,!)"

Watch HTTP

)

$$$&&FB G0

".)

)00$$$&&0#1(0H&

%%)

)00$$$&&0

Example HTTP Session

'."!' .%$#) )00$$$&&&')FB0 %.)

)00,%I) %& $$$&&&') )FB)7(&FB!'%& #%)31JKK=K 0'

The Client Request

  • ! "

#$%!""&'(")%*+ ,')- ./0 ...$"" 12"3

Anatomy of the Client Request

G003&3

.0'& "%!3&3& 8)3&B'3&3+L-

)#0#%#0,1,(#0 ;##0;#M0M

'$%'($$&

1##)1

<$:%'##

1'#)#*'%

''+''$'&-

Anatomy of the Client Request

1#)*0>&B+(I"K&B3I 2'$7-

'($&

)$$$&&&'

.'%3&3 /%3&B "!& ($'&

)N1!

(56& %+L-

slide-7
SLIDE 7
  • .

Server Response

4''52 6%4&*4''4',&47% *$3$897(#0 % %4&*4''&'7% 1"894: 1" 1;8" <"=*"<"= <$>?$"";@?= <8=-"<84=88.

Anatomy of Server Response

03&39BB/N

"!"' '9BB)4$%' 2$,'&

4)9>"9BB39B)K>)9JG

4!& G+G$-

1'%')9>"9BB33>)BJ)33G

'$'$'%'& 8%%($#& %($'#' .$'#+L-

Anatomy of Server Response

1#)=9O

7(%('&

)

'!$& %$'.$' !&

1),0

'%'& 1, ($(!(,%& /#)

'!'#,

  • Anatomy of Server Response

')

<title>Sample Homepage</title> <img src="/images/oreilly_mast.gif"> <h1>Welcome</h2>This is the web page of ...

HTTP 1.0 v. 1.1: Getting Objects

/($!# ! '%%(;$#&

Client Web Browser Web Server Give me /index.html Here you go... Now, give me logo.gif Here you go...

HTTP 1.0 v. 1.1

3&B)

.$ $!&

3&3

.'% $!& "'(($'!&

slide-8
SLIDE 8
  • Example: HTTP 1.0 v. 1.1

3&B)G##

/)G0',& /)G0#&#% /)G0(&#%

3&3)G##

/)G0',& G0#&#% G0(&#%

Client Requests

!.')

')''%. 8'%.' '& '%)'%($ !##& <')'%%'% /".&

Client Methods

G'/")2$$$ '%& 4)

"G,'. '%& "!$'1'%'($ '%.''& %%($#& ,)

%($'!%# '.& %'('%'' !&

Server Responses

!!' )

)!( '#''#& ')%(!' (;(#!' <')'&

Server Status Codes

3BB13EE % 9BB19EE ."% =BB1=EE .'' >BB1>EE . KBB1KEE "!

Some Important Status Codes

9BB) /N

.$%&

=B3) !'

"!'$&

>B> 7'

4',

KBB "!

$2("!

slide-9
SLIDE 9
  • /

HTTP Is Stateless

2')

756 !#%1' 7!5('6 ( '%%($%'% '!)/%((

  • %)

%+##1%- '(''!.'A '$)

+- 4#.:!!+

  • Overview

!" ""

''

Web Data Formats

##%

P

%1'(#''

2$!P''. '%##+P P"-&

HTML: An Example

QR Q4RQ04R Q</4@R Q3R<'7(( <Q03R /!) Q=R"Q0=R Q(R% $Q0(R QR QR)' Q0R QR('3EFBQ0R QR'!Q0R Q0R

<h3>Fiction</h3> <b>Waiting for the Mahatma</b> <UL> <LI>Author: R.K. Narayan</LI> <LI>Published 1981</LI> </UL> <b>The English Teacher</b> <UL> <LI>Author: R.K. Narayan</LI> <LI>Published 1980</LI> <LI>Paperback</LI> </UL> </BODY> </HTML>

HTML: A Short Introduction

## '#)

  • "#''#
  • ,)
  • QRL Q0R
  • QRL Q0R

'# '%'+&#&% 2'5"!6 %-

HTML: Sample Commands

QR) QR)'' QR) Q3R)#'# Q9R)'1!'#Q=R Q>R# Q<RQ0<R)<'

slide-10
SLIDE 10
  • Overview

!" ""

''

Sites that know you...

%$,)

&& $$$&*&

($&

@($(& *&($(! ($'''&

$''?

What is a Cookie?

"%'#'($( !':''!& "!''1 %+((% &- !($( $('(+ L-

Example Cookie Use

2("&$( %.!$& %&"!# '(%56( '(%.!&M :(& #'#'!'& !'! (&

  • Tracking Unique Visitors

"3).#% & "9)&2("!#$ .4& "=)"!# .4& ">) &($' #$G.&

Cookie Conversation

Browser Server

Give me the home page! Here’s the home page plus a cookie. Now, give me the news page (cookie is sent automatically) I’ve seen you before… Here’s the news page.

slide-11
SLIDE 11
  • Cookie Notes

'3EE>%73&3 (#>N 7'+&%&- !9B& )

, ,''

$($& 71($(A

Magic Cookies

%' ##'#& %#''$ #$' 5#6%# '%($#&

Cookie Standards

8B+7-)

#% '(($'! 2$%8

83

'##+- ''1 93BE ($8B($, 2$8B&

Why use Cookies?

#.! #*'$( "# #)

&#&'$!$# !?

Cookie Anatomy

8B%,)

7 8 4 , "

Cookie Parts: Name/Value

7

7%+.'- $ &

8

8%+.'- $ &

slide-12
SLIDE 12
  • *

Cookie Parts: Domain

/#%'$' $''& ,*&' &:+#%$ %$$A- <'%'%' %$(!!'$(#&

,!&'&$' ' &!&'&

Cookie Parts: Domain

7'$''$ '&

)'! $'&

@$!#!'

,!&'& '&'&&$ !&'&' !&'& &

7$' $&

Cookie Parts: Path

#$& <'%% #'& ,).#% &0&<'%$ ('#%'0& %%0$( '#+&-

Cookie Parts: Expires

"%$$,& "%'G$+G-)

2'4411@@@@))""G

%!!(($$ '$, ($&

$ '&

Cookie Parts: Secure

%%# '#'$ & $(! +""&- $'% '#1 $( &

Weaknesses of Cookies

1%! !'%%'%% &(#%?

('% :''! ('

%

slide-13
SLIDE 13
  • +

Cookie Abuse - I

!#$' %(

0''0

#' ''%

$'$A

<:%#

Cookie Abuse - II

'!'0531,#%6 "%)

(&#3O

Q#S5,&&&'!&0?#S&&&3O6R

'!&4 $ #''%

"'!&#! & #(A

Legal Abuse

*&(#' %#' '%

'.4%$# '''( ".%!'#'(

  • ((%##

*:'('+-

Cookie Blocking Software

% (#%$&

&

<+-':$% '('&&&