Internet Engineering: Web Application Architecture Ali Kamandi Sharif University of Technology kamandi@ce.sharif.edu Spring 2007
Centralized Architecture mainframe terminals terminals 2
Two Tier Application Architecture � In the 90’s, systems should be client- server 3
Client-Server Architecture � Client-Server divides programs into two types � Server – manages information system resources or provides well defined services for client � Client – communicates with server to request resources or services � Advantage – Deployment flexibility � scalability, maintainability � Disadvantage – Potential performance, security, and reliability issues from network communication 4
3 Layer Architecture 5
Three-Layer Architecture � Layers can reside on one processor or be distributed to multiple processors � Data layer – manages stored data in databases � Business logic layer – implements rules and procedures of business processing � Presentation (View) layer – accepts user input and formats and displays processing results 6
Web Architecture DHTML HTTP SQL Browser PHP script Database (IE, FireFox, Opera) Web Server Database HTML data (Apache, IIS) Server Desktop (PC or MAC) Presentation Dynamic HTML Generation, Persistence HTML+DHTML Business Logic 7
Enterprise Application Model 8
Internet and Web-based Application Architecture � Web is complex example of client-server architecture � Can use Web protocols and browsers as application interfaces � Benefits � Accessibility � Low-cost communication � Widely implemented standards 9
Negative Aspects of Internet Application Delivery � security � Fluctuating reliability of network throughput, slow speed � Volatile, changing standards 10
Presentation layer (Client Side) � Issue request to remote server using appropriate protocol (usually HTTP) � Accept and render the returned HTML (or JPEG, ..) file � Allow plug-ins to handle new file types � execute client-side scripts in JavaScript � Accept user input via a variety of controls on a form 11
Application Layer: Server Side Presentation + Business Logic � Server (Apache, IIS) � Identifying appropriate action to take – fetch a file � Sending output back to caller � Support for: � thousands of concurrent users � multi-threading [ allow multiple processes to run concurrently] � caching [holding results in a temporary store to reduce re- calculation] � Server Script (e.g. in PHP) � Interacting with the server (accessing input and generating output) � interpreting the requests according to business rules � requesting the appropriate data from the Persistence layer � computing derived data � creating the HTML (or GIF, ...) for the page 12
Persistence layer � interaction with the database using standard languages e.g. SQL queries using database-specific protocol over TCP/IP � define and modify the data structures (e.g. tables) � insert, update and delete data � maintain data persistently, with backup and recovery � handle transactions to support concurrent access to the database via locking � optimise access by compilation of queries, indexing, replication of tables etc. 13
Enterprise IT Requirements FRONT APPLICATION BACK DATA INTERNET OFFICE OFFICE WAREHOUSE INTEGRATION On-line Off-line Legacy Apps Integration Integration DB2 Custom Apps Purchased Apps SAP Thin Client Apps Business Intelligence 14
Middleware � Connects parts of an application and enables requests and data to pass between them 15
CORBA � A distributed component-oriented model � An architecture for defining components and their interactions � From client-side (GUI) to server-side (business) components � A container framework: lifecycle, security, transactions, persistence,… � The Industry’s First Multi-Language Component Standard � Multi-languages, multi-OSs, multi-ORBs, multi- vendors, etc. 16
What is the purpose / goals of CORBA? � Enable the building of plug and play component software environment � Enable the development of portable, object oriented, interoperable code that is hardware, operating system, network, and programming language independent 17
How to meet goals? � Interface Definition Language (IDL) � Object Request Broker (ORB) 18
Interface Definition Language (IDL) � Language Independence � Defines Object Interfaces � Hides underlying object implementation � Language mappings exist for C, C++, Java, Cobol, Smalltalk, and Ada 19
Interface Definition Language (IDL) module <identifier> Defines a container { (namespace) interface <identifier> [:inheritance] { Defines a <type declarations>; CORBA object <constant declarations>; <exception declarations>; <attribute declarations>; [<op_type>] <identifier>(<parameters>) Defines a [raises exception][context]; } method 20 }
IDL Compiler IDL Definitions 1. Define objects using IDL 2. Run IDL file through IDL compiler 3. Compiler uses language IDL mappings to generate Compiler programming language specific stubs and skeletons Stubs Skeletons 21
Object Request Broker (ORB) � Implementation of CORBA specification � Middleware product � Conceptual Software Bus � Hides location and implementation details about objects 22
Client / Object Interaction Client Obj Impl Client Obj Impl IDL IDL IDL IDL ORB ORB TCP/IP TCP/IP ATM ATM OSI OSI Network 23
CORBA Services � Provide basic infrastructure functionality � Currently there are more than 15 defined services � Naming - maps human names to object references � Event � Object Trader - discover objects based on the services they provide (Yellow Pages) � Transactions – allows distributed objects to participate in atomic transactions 24
Enterprise Application Model 25
J2EE clients � Web clients � Dynamic web pages with HTML, rendered by web browsers. � Can include applets. � Communicates with server typically using HTTP. � Application clients � User interface using GUI components such as Swing and AWT. � Directly accesses the business logic tier. 26
Web-tier Components � Client can communicate with the business tier either directly or through servlets or JSP that are located in the web-tier. � Servlets are special classes to realize the request-response model (get, post of HTTP). � JSP is a developer-friendly wrapper over the servlet classes. 27
Business-tier Components � Business logic, rules, computation � Enterprise Java Beans (EJB) can be used to implement this tier. � This tier receives the data from the web- tier and processes the data and sends it to the EIS-tier and takes the data from the EIS and sends it to the web-tier. 28
Enterprise Information System (EIS) Tier � In general this corresponds to the database (relational database) and other information management system. � The other information management systems may include Enterprise Resource Planning (ERP) and legacy system connected through open database connectivity. 29
Enterprise Java Bean (EJB) (1) � EJBs are distributed components used to implement business logic (no UI) � Client of EJBs can be JSPs, servlets, other EJBs and external aplications � Clients see interfaces 30
Enterprise Java Bean (EJB) (2) � At run-time, an enterprise bean resides in an EJB container. � An EJB container provides services such as security, transaction, deployment, … � Process of installing an EJB in a container is called EJB deployment. 31
Enterprise Java Bean (EJB) (3) � Entity Beans � Represent persistent business Entity � Persisted in storage system (usually Database) � Session Beans � Encapsulate complex business logic � Can coordinate transactional work on multiple entity beans � Message Driven beans 32
States and Persistence � Session beans can be � Stateless- belong to client for duration of a method call � Stateful- belong to client for duration of client conversation � Entity beans can have � Bean-managed persistence- The developer writes SQL code to store, retrieve and update database � Container managed persistence- The developer provide database mapping information that allows the container to manage persistence 33
JMS � Point-to-point � Destination is “queue” 34
JMS � Publish-subscribe � Destination is “topic” 35
What is Application Server � Application servers enable the development of multi-tiered distributed applications. They are also called “middleware” � An application server acts as the interface between the database(s), the web servers and the client browsers 36
J2EE Application Servers � Major J2EE products: � BEA WebLogic � IBM WebSphere � Sun iPlanet Application Server � Oracle 9iAS � HP/Bluestone Total-e-Server � Borland AppServer � Jboss (free open source) � … 37
Recommend
More recommend