Connection-oriented vs Connectionless Servers Connectionless servers Advantages: Do not suffer from the problem of resource depletion Can supply broadcast or multicast communication Disadvantages: Can not depend on underlying transport for reliable delivery Application protocols respond for reliability 哈工大计算机学院李全龙 Network Application Development Server Software Desi
哈工大计算机学院 李全龙 Network Application Development Server Software Design 6 Connection-oriented vs. Connectionless Servers Connectionless servers Advantages: Do not suffer from the problem of resource depletion Can supply broadcast or multicast communication Disadvantages: Can not depend on underlying transport for reliable delivery Application protocols respond for reliability
Optimizing stateless servers Consider a connectionless server for file reading Wefⅰnd Overhead of opening and closing file Clients may read only a dozen bytes in each equest Clients tend to read files sequentially To optimize the performance Maintain a small table of file information State information 哈工大计算机学院李全龙 Network Application Development Server Software Desi
哈工大计算机学院 李全龙 Network Application Development Server Software Design 7 Optimizing stateless servers Consider a connectionless server for file reading We find: Overhead of opening and closing file Clients may read only a dozen bytes in each request Clients tend to read files sequentially To optimize the performance Maintain a small table of file information State information
Optimizing stateless servers Table of information about files clients are using hash(IP addr, port) Filename: X Offset: 512 Buffer pointer: Buffer for file x starting at byte 512 Filename: y Offset: 1024 Buffer pointer Buffer for file y starting at byte 1024 哈工大计算机学院李全龙 Network Application Development Server Software Desi
哈工大计算机学院 李全龙 Network Application Development Server Software Design 8 Optimizing stateless servers Filename:X Offset:512 Buffer pointer: Filename:Y Offset:1024 Buffer pointer: Table of information about files clients are using hash(IP addr,port) Buffer for file X starting at byte 512 Buffer for file Y starting at byte 1024
Optimizing stateless servers Improve performance without any penalty? Even a small amount of information can cause a server to perform badly when machines, client programs, or networks fail Frequent crashes can cause one client to dominate the table by filling it with entries that will never be use A programmer must be extremely careful when optimizing a stateless server 哈工大计算机学院李全龙 Network Application Development Server Software Desi 9
哈工大计算机学院 李全龙 Network Application Development Server Software Design 9 Optimizing stateless servers Improve performance without any penalty? Even a small amount of information can cause a server to perform badly when machines, client programs, or networks fail Frequent crashes can cause one client to dominate the table by filling it with entries that will never be used A programmer must be extremely careful when optimizing a stateless server
Four basic types of servers Iterative connectionless Iterative connection-oriented Concurrent connectionless Concurrent connection-oriented Iterative servers suffice only for the trivial application protocols Iterative servers work best with simple services accessed by a connectionless access protocol 哈工大计算机学院李全龙 Network Application Development Server Software Design 10
哈工大计算机学院 李全龙 Network Application Development Server Software Design 10 Four basic types of servers Iterative connectionless Iterative connection-oriented Concurrent connectionless Concurrent connection-oriented Iterative servers suffice only for the trivial application protocols Iterative servers work best with simple services accessed by a connectionless access protocol