Clients and Servers - Faculty of Computer Science

Download Report

Transcript Clients and Servers - Faculty of Computer Science

GR01E - Electronic Commerce Overview
Module 1 Technology:
D. Distributed Computing
Copyright © 2003 T. Trappenberg
Overview D 1
Why distributed systems: Benefits & Challenges
The Sydney Olympic game system: see text page 29-30
Divide-and-conquer
Interacting autonomous systems
Concurrencies
Transactions
Copyright © 2003 T. Trappenberg
Overview D 2
A three-tier architecture
What is middleware?
Copyright © 2003 T. Trappenberg
Overview D 3
How to get it work
Open systems, standards, protocols
Message passing
Distributed objects technology:
e.g. CORBA (multi-language technology)
RMI (Java-based technology)
etc
Copyright © 2003 T. Trappenberg
Overview D 4
Clients and Servers
Servers: File server, Database server, Web server, print server, object server
Not mainframe-terminal, not necessarily big vs. small (rather specialized)
The new hype: peer-to-peer
Copyright © 2003 T. Trappenberg
Overview D 5
Database servers
Relational database: series of tables that can contain links
Functions of a database server:
• To interpret SQL statements
• To optimize queries
• To prevent the errors from concurrent access
• To ensure internal consistency (referential integrity)
• To detect and act upon deadlock
• To administer security
• To administer backup and recovery.
A distributed database is one whose tables are distributed among a number of
networked computers
 downloading, data replication, fragmentation
Copyright © 2003 T. Trappenberg
Overview D 6
SQL (Structured Query Language)
Most common database access language often embedded within another
language such as C++ or Java. There are several dialects such as ANSI/ISO
SQL, IBM DB2, Ingres variant, a Microsoft SQL server variant and an
Oracle variant.
Example:
SELECT BookId, Title, Borrowings.BorrowerName FROM
Borrowings, Privileged WHERE
Borrowings.BorrowerName = Privileged.BorrowerName
Commit, rollback, locks …
Copyright © 2003 T. Trappenberg
Overview D 7
The history of SQL and relational databases
SQL was based on ideas propounded in the early 1970s from the
ideas of the research scientist Ted Codd at the IBM San José
Research Laboratories. It was originally developed in order to
provide a semi-natural language interface to the IBM relational
database system. Originally relational databases had a number of
competitors which were much more efficient in terms of
performance, for example database management systems which
were based on a network model of data. However, more and more
efficient implementations emerged in the late 1980s and this has
lead to the situation where relational databases and SQL now
dominate the software industry.
D. Ince, Developing Distributed and E-commerce Applications, Addison Wesley 2002
Copyright © 2003 T. Trappenberg
Overview D 8
Web Servers
How Web servers work
Web pages: HTML
Copyright © 2003 T. Trappenberg
Overview D 9
Static pages, dynamic pages, … web services
HTML (see text page 111-113)
Server side programs:
Forms, CGI, Perl, ASP, Servlets (memory resident), …
Client side programs:
Java applets, JavaScript, VBScript, …
Copyright © 2003 T. Trappenberg
Overview D 10
<HTML>
<HEAD>
<TITLE> Links Page </TITLE>
</HEAD>
<BODY>
<H1> Darrel Ince's links </H1>
You really ought to look at these sites:
<UL>
<LI> <A HREF = "http://www.WelshRugby.com/home">
The home of Welsh rugby </A> </LI>
<LI> <A HREF = "http://www.open.ac.uk/staff/Darrel">
My home page</A></LI>
<LI> <A HREF =
"http://www.open.ac.uk/Faculty/Computing">
My department's page</A></LI>
</UL>
</BODY>
</HTML>
Copyright © 2003 T. Trappenberg
Overview D 11
Web design and usability
Computer
Person
Execute
Read/Scan
Process
Goals
Output
Evaluate
Copyright © 2003 T. Trappenberg
Overview D 12
Jamie Blustein’ resources:
… for example:
http://www.cs.dal.ca/~jamie/course/CS/4173/Resources/#UI
http://www.usability.gov/guidelines/
Copyright © 2003 T. Trappenberg
Overview D 13
Server side programs: Servlets
Forms, CGI, Perl, ASP, Servlets (memory resident), …
HTML GET and POST
Copyright © 2003 T. Trappenberg
Overview D 14
•They are portable across a wide variety of servers.
•Since servlets are written in Java they can access a huge variety of Java features
including CORBA, RMI, Java security facilities and database connectivity
facilities.
•Servlets are resident in memory. With CGI programming in languages such as
Perl every time a request comes in from a Web browser a new process has to be
spawned and terminated when the connection ends. This means that there can be
quite a heavy overhead on the Web server when it loads and unloads programs.
•Since servlets are Java-based they will contain all the security and safety
features that are built into the language.
•Servlets can maintain state across requests, something that in the early days of
the World Wide Web proved difficult. This means that a servlet can remember
data and details from a previous request.
•The object-oriented model within Java is a much cleaner model than is found
with languages such as C and Perl. When you look at Perl CGI programs you
often see huge, monolithic, difficult-to-understand programs. The object-oriented
nature of Java also provides the potential for greater reuse.
•Servlets, because they integrate well with the security technology associated
with Java can be configured to be highly secure.
Copyright © 2003 T. Trappenberg
Overview D 15
Client side programs:
Java applets, JavaScript, VBScript, …
Examples:
Java applet:
<OBJECT code = "java:name" WIDTH = n HEIGHT = n>
</OBJECT>
JavaScript:
<SCRIPT LANGUAGE = "JavaScript">
document.writeln( "<H3> Hello there");
</SCRIPT>
Copyright © 2003 T. Trappenberg
Overview D 16
XML: eXtensible Markup Language
What is XML? markup language, language to define languages
Copyright © 2003 T. Trappenberg
Overview D 17
attribute
tag
<PRODUCT Postage = “Heavy”>
<PRODUCTNAME> CoatBlue</PRODUCTNAME>
<PRODUCTPRICE> 34000</PRODUCTPRICE>
..
</PRODUCT>
Copyright © 2003 T. Trappenberg
Overview D 18
Document type definition: language definition
<?xml version = "1.0" encoding ="UTF-8"?>
<!DOCTYPE ENTRY[
<!ELEMENT ENTRY ENTRYPAIR*>
<!ELEMENT ENTRYPAIR (NAME, DEFINITION)>
<!ELEMENT NAME (#PCDATA)>
<!ELEMENT DEFINITION (#PCDATA)>
<]>
Example:
<ENTRY>
<ENTRYPAIR>
<NAME>Dodo</NAME>
<DEFINITION> A dead bird</DEFINITION>
</ENTRYPAIR>
<ENTRYPAIR>
<NAME>Blackbird</NAME>
<DEFINITION> A thieving bird</DEFINITION>
</ENTRYPAIR>
</ENTRY>
Copyright © 2003 T. Trappenberg
Overview D 19
Processing XML documents:
XML browsers
XML parsers
XML API
Copyright © 2003 T. Trappenberg
Overview D 20
SGML: General Markup Language
FSML: Financial Services Markup Language
SVG: Scalable Vector Graphics (www consortium)
MathML
XHTML: proposed successor of HTML
…
Copyright © 2003 T. Trappenberg
Overview D 21
Concurrencies and Locks
Thread: chunk of code that can be executed in parallel (independent) of other
chunks of code. A scheduler supervises the execution of threads.
In a distributed system we relay on independent processes, for example, we might
have to wait for some requested data. In the meantime we could use the processor
time other tasks that might be pending.
 good distributed systems are multi-threaded
 parallel computing: `utilization of multiple processors’
However, if a thread depends on some data that should not be modified by
another thread during its processing, then we have to lock that data.
Client-servers: Write locks, read locks, … and dead locks
(time limits, lock manager, …)
Database servers: Row-, page-, table-, database-locking
Copyright © 2003 T. Trappenberg
Overview D 22
Transactions
Sequence of operations
ACID: Atomicity, Consistency, Isolation, Durability
Server transactions vs concurrent transactions
Transaction monitors
e.g. Sun’s Enterprise JavaBeans
interfaces
classes
containers
servers
transaction monitor
…
Copyright © 2003 T. Trappenberg
Overview D 23
(Ro)bots, agents and spiders
Program that `travel the web’ to gather information
 Static argents
 Mobile agents
For example, search engines, web tools such as inactive-link alert, news agents,
e-mail harvesting for spamming, …
Copyright © 2003 T. Trappenberg
Overview D 24