Bài giảng Kiến trúc phần mềm - Bài 6: Middleware - Trần Minh Triết
Nội dung của bài giảng sử dụng:
Session 4:
A Guide to Middleware Architectures and Technologies
trong bộ slide Software Architecture Essential
của GS. Ian Gorton
Software Engineering Institute
Carnegie Mellon University
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Kiến trúc phần mềm - Bài 6: Middleware - Trần Minh Triết", để tải tài liệu gốc về máy hãy click vào nút Download ở trên
Tóm tắt nội dung tài liệu: Bài giảng Kiến trúc phần mềm - Bài 6: Middleware - Trần Minh Triết
CTT526 - Kiến trúc phần mềm Middleware PGS.TS. Trần Minh Triết tmtriet@fit.hcmus.edu.vn Trường Đại học Khoa Học Tự Nhiên Khoa Công Nghệ Thông Tin Bộ môn Công Nghệ Phần Mềm Version 1.0 CuuDuongThanCong.com https://fb.com/tailieudientucntt Nội dung của bài giảng sử dụng: Session 4: A Guide to Middleware Architectures and Technologies trong bộ slide Software Architecture Essential của GS. Ian Gorton Software Engineering Institute Carnegie Mellon University 2 CuuDuongThanCong.com https://fb.com/tailieudientucntt Introduction Middleware is the plumbing or wiring of IT applications Provides applications with fundamental services for distributed computing Insulates applications from underlying platform (OS, DBMS, etc) APIs Lots of middleware exists Different purposes Different vendors Different standards and proprietary technologies 3 CuuDuongThanCong.com https://fb.com/tailieudientucntt Middleware Classification 4 Business Process Orchestrators Message Brokers Application Servers Transport Message-Oriented Middleware, Distributed Objects Systems J2EE, CCM, .NET BizTalk, WebSphere Message Broker, SonicMQ BizTalk, TIBCO StaffWare, ActiveBPEL CuuDuongThanCong.com https://fb.com/tailieudientucntt Outline CORBA Message-oriented middleware J2EE Message brokers Business process orchestrators 5 CuuDuongThanCong.com https://fb.com/tailieudientucntt CORBA Venerable distributed object technology Still widely used in telecomms, defense Many different implementations 6 Network Client Object Reference request Server Servant reply client ORB server ORB CuuDuongThanCong.com https://fb.com/tailieudientucntt CORBA Code Example 7 module ServerExample { interface MyObject { string isAlive(); }; }; class MyServant extends _MyObjectImplBase { public String isAlive() { return "\nLooks like it\n"; } } ORB orb = ORB.init(args, null); MyServant objRef = new MyServant(); orb.connect(objRef); ORB orb = ORB.init(args, null); // Lookup is a wrapper that actually access the CORBA Naming // Service directory – details omitted for simplicity MyServant servantRef = lookup(“Myservant”)String reply = servantRef.isAlive(); CORBA IDL Server Client CuuDuongThanCong.com https://fb.com/tailieudientucntt CORBA – Some Thoughts Many associated services, eg Naming Notification Transactions Synchronous technology, client-server relatively tightly coupled Remote calls can/will fail State management in server objects creates „interesting‟ recovery issues 8 CuuDuongThanCong.com https://fb.com/tailieudientucntt Messaging - MOM Basic Message Oriented Middleware (MOM) provides features like: Asynchronous communications between processes, applications and systems Send-and-forget Delivering messages despite failures Transactional Messaging Deliver all messages in a transaction, or none Persistence Messages can be logged at the server and hence survive server failure 9 CuuDuongThanCong.com https://fb.com/tailieudientucntt Basic Messaging 10 Send (queue, message) Put message onto queue Receive (queue, message) Get message from queue No dependency on state of receiving application on message send receivesend queue CuuDuongThanCong.com https://fb.com/tailieudientucntt Persistence 11 receivesend queue Receipt of message at queue implies message is written to disk log Removal of message from queue deletes message from disk log Trade-off performance versus reliability CuuDuongThanCong.com https://fb.com/tailieudientucntt MOM Server 12 MOM Server Sending Applications Senders Message Handler Thread Pool Sending Applications Receivers Peer-to-peer MOM technologies are the alternative design CuuDuongThanCong.com https://fb.com/tailieudientucntt MOM Transactions 13 B e g i n t r a n s a c t i o n . . . u p d a t e d a t a b a s e r e c o r d p u t m e s s a g e o n q u e u e . . . c o m m i t t r a n s a c t i o n B e g i n t r a n s a c t i o n . . . g e t m e s s a g e f r o m q u e u e u p d a t e d a t a b a s e r e c o r d . . . c o m m i t t r a n s a c t i o n CuuDuongThanCong.com https://fb.com/tailieudientucntt MOM Transactions Sender and receiver do *not* share a transaction Rollback on receiver does not affect the sender (already committed) „Synchronous‟ operations are not atomic Request/response is 3 transactions not 1 Put to request queue Get from request queue, put to response queue Get from response queue 14 receivesend Request queue Response queue sendreceive CuuDuongThanCong.com https://fb.com/tailieudientucntt Scaling MOM 15 MOM Server Senders Receivers MOM Server ApplicationQ ApplicationQ CuuDuongThanCong.com https://fb.com/tailieudientucntt Messaging – Some thoughts Highly attractive asynchronous technology Supports loosely-coupled, dynamic applications Scales well, high throughput possible Many implementations, various qualities of service caveat emptor 16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Publish-Subscribe Messaging Extension of MOM to provide 1-to-N, N-to-1, and N-to- N communications Messages are „published‟ to logical subjects or topics Subscribers receive all messages from subjects they subscribe to 17 Pub Subject Sub Sub Sub Create/ Publish Register/ Subscribe CuuDuongThanCong.com https://fb.com/tailieudientucntt Publish-Subscribe with Multicast 18 r v d r v d P u b l is h e r S u b s c r ib e r r v d S u b s c r ib e r r v d S u b s c r ib e r r v r d r v d S u b s c r ib e r r v d S u b s c r ib e r r v r d Based on TIBCO Rendezvous CuuDuongThanCong.com https://fb.com/tailieudientucntt Performance 19 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 1 0 2 0 3 0 4 0 5 0 N o . O f S u b sc r i b e r s M i l l i se c o n d s M C 1 M C 2 Q B CuuDuongThanCong.com https://fb.com/tailieudientucntt Subject/Topic Naming 20 Sydney DevGroup SupportGroup InformationInformation work gossip work gossip Sydney Sydney/DevGroup Sydney/DevGroup/Information Sydney/DevGroup/Information/work Sydney/DevGroup/Information/gossip Sydney/SupportGroup Sydney/SupportGroup/Information Sydney/SupportGroup/Information/work Sydney/SupportGroup/Information/gossip Sydney/*/Information Sydney/DevGroup/*/* Sydney/DevGroup/** CuuDuongThanCong.com https://fb.com/tailieudientucntt Publish-Subscribe – Some Thoughts Highly decoupled messaging style Publishers don‟t know about subscribers Subscribers don‟t know who is publishing Publishers and Subscribers can dynamically appear and disappear Issues – Reliability Transactions Security Performance 21 CuuDuongThanCong.com https://fb.com/tailieudientucntt J2EE Overview 22 B ro w s e r -b a s e d c l ie n t a p p lic a t io n s (H T M L , a p p le ts , D H T M L /s c r ip t in g ) J a v a c l ie n t a p p l ic a t io n s E R P s , C R M s , M a in f ra m e T P s y s te m s S e rv le ts , J S P s W e b s e rv e r H T T P J a v a R M I A p p l ic a t io n c o m p o n e n ts E J B s C lie n t t ie r B u s in e s s C o m p o n e n t t ie r E IS T ie rW e b T ie r C o n ta in e r S e rv ic e s C o m p o n e n ts e g . J T S , J M S R D B M S J D B C J C A R M I W in d o w s /C O M c l ie n t a p p lic a t io n s C A S C O M B r id g e , R M I o v e r I IO P CuuDuongThanCong.com https://fb.com/tailieudientucntt J2EE Application Server In J2EE, the application server container provides the execution environment for the J2EE-specific components EJBs Message-driven beans Connectors Container provides additional services for hosted components Transactions Security Directory Threading Connection pooling 23 CuuDuongThanCong.com https://fb.com/tailieudientucntt EJB Container 24 Application Server EJB Container Transaction Service Directory Service Security Service Thread Pool Connection Pool Persistence Lifecycle Management EJB Pool CuuDuongThanCong.com https://fb.com/tailieudientucntt Beans and State 25 EJB Container state Stateless bean pool Stateful beans state state state state state state EJB Clients CuuDuongThanCong.com https://fb.com/tailieudientucntt Deployment Descriptors 26 EntityStock.BrokerHome db.entitystock.BrokerHome db.entitystock.Broker db.entitystock.BrokerBean Stateless Container EntityStock.BrokerHome Remote * Required CuuDuongThanCong.com https://fb.com/tailieudientucntt J2EE – Some Thoughts Standards-based, multiple vendors, portable Good open source technology available Quality of implementations varies considerably Java only, wide platform support Performance is good, but varies between suppliers Scalable, fail over support through clustering Good integration with web technologies Supports various design patterns, flexible but more complex (e.g. stateful beans/scalability, entity beans) Standards evolving, need to monitor 27 CuuDuongThanCong.com https://fb.com/tailieudientucntt Message Brokers - Motivation 28 Web Component Legacy System #1 Legacy System #2 Legacy System #3 Legacy System #4 In-format In-format In-format In-format In-format Key: Message = In-format Message Transform Legacyformat API call Queue Read CuuDuongThanCong.com https://fb.com/tailieudientucntt What if the common In-format message format changes? any legacy system API changes? any of the transformations needs modifying? 29 CuuDuongThanCong.com https://fb.com/tailieudientucntt Alternative Solution Transformations in broker Simplified endpoints Decouples Web and legacy components 30 Web Component Legacy System #1 Legacy System #2 Legacy System #3 Legacy System #4 In-format L1-format L2-format L3-format L4-format Key: Message = Message Broker CuuDuongThanCong.com https://fb.com/tailieudientucntt Message Brokers Developed specifically for Enterprise Application Integration (EAI) Add new layers of functionality to MOM Message transformation Rules engine Intelligent routing Adapters Typically (but not necessarily) built on top of a MOM layer 31 CuuDuongThanCong.com https://fb.com/tailieudientucntt Message Broker Features Message transformation – transform between different source/target formats Graphical message format definition and mapping tools High performance transformation engines Message format repositories Intelligent routing Route messages based on message content Rules Engine Scripting language, built-in functions Application programming environment 32 CuuDuongThanCong.com https://fb.com/tailieudientucntt Message Brokers 33 Transformation Routing Rules Processing Input Messages Output Messages Hub and Spoke Architecture CuuDuongThanCong.com https://fb.com/tailieudientucntt Example - WMQI 34 CuuDuongThanCong.com https://fb.com/tailieudientucntt BizTalk Mapping Tool 35 CuuDuongThanCong.com https://fb.com/tailieudientucntt Adapters An adapter is a component that resides between the message broker and the source/target systems Simplify complexity of end system interface through an abstraction layer Thin adapters - simple wrappers Thick adapters Programmable Abstract representation of services and meta-data Centralized adapters co-located with broker Distributed adapters execute in own process and may be located with source/target system 36 CuuDuongThanCong.com https://fb.com/tailieudientucntt Message Brokers – Some Thoughts Embeds transformations/routing in broker Can get complex Possible scaling issues Need to replicate brokers Failure handling Lightweight, rarely designed to recover from failure Often proprietary technology Good open source, standards-based like Mule now available 37 CuuDuongThanCong.com https://fb.com/tailieudientucntt Business Process Orchestration Commonly known as workflow Aim is to automate business processes which need to access data and business logic across disparate back-end applications Builds on EAI to ensure business processes are executed in the defined order using the required data Builds on middleware providing: Process execution engine Visual process definition tools Process monitoring tools 38 CuuDuongThanCong.com https://fb.com/tailieudientucntt Typical Scenario Business process automation 39 Customer Purchasing SAP Customer Receiving Siebel Sales desk Shipping Credit Validation Accounts Payable Accounts Receivable Oracle CuuDuongThanCong.com https://fb.com/tailieudientucntt Example - BizTalk 40 CuuDuongThanCong.com https://fb.com/tailieudientucntt BPO Architecture 41 Message Broker Adapter Adapter Adapter CuuDuongThanCong.com https://fb.com/tailieudientucntt BPEL Web Services standard for describing workflows Many design and execution tools Eg ActiveBPEL Version 2.0 is a significant improvement 42 CuuDuongThanCong.com https://fb.com/tailieudientucntt Integration Issues – Point-to-Point Point-to-Point evolution Spaghetti architecture, hard to modify potentially (N2-N) interfaces 43 1 business process = 4 interfaces 5 business processes = 20 interfaces CuuDuongThanCong.com https://fb.com/tailieudientucntt Broker Spaghetti No free lunch Just relocates the spaghetti 44 message broker CuuDuongThanCong.com https://fb.com/tailieudientucntt Enterprise Data Model Source sends message to target with common message format as payload. Target receives message and transforms common format into its own local data representation. 2xN transformations, no broker needed Getting agreement is the tough bit 45 Enterprise Data Model CuuDuongThanCong.com https://fb.com/tailieudientucntt Summary Middleware: makes building complex, distributed, concurrent applications simpler. institutionalizes proven design practices by supporting them in off-the-shelf middleware technologies. Architect‟s job is to „mix n‟match‟ technologies to create appropriate solutions Analyze trade-offs Open-minded (no hammer/nail thinking) No good/evil, its just technology 46 CuuDuongThanCong.com https://fb.com/tailieudientucntt
File đính kèm:
- bai_giang_kien_truc_phan_mem_bai_6_middleware_tran_minh_trie.pdf