Server software design Algorithms and Issues Chuan-Ming LIu Computer Science and Information Engineering Spring 2004, NTUT TAIWAN CSIE NTUT Taiwan
1 CSIE, NTUT, Taiwan Server Software Design Algorithms and Issues Chuan-Ming Liu Computer Science and Information Engineering Spring 2004, NTUT TAIWAN
●。 Conceptual Server Algorithm o Simple server Algorithm 1. Create a socket 2. Bind the socket to the port 3. Enter an infinite loop Accept request Process request Reply request o Not enough in practice generall SIE, NTUT, Taiwan
2 CSIE, NTUT, Taiwan Conceptual Server Algorithm Simple Server Algorithm 1. Create a socket 2. Bind the socket to the port 3. Enter an infinite loop • Accept request • Process request • Reply request Not enough in practice generally
●。 Conceptual Server Algorithm o Consider file transfer first client needs a 200 Mb file o Second client needs a 20 byte file If the server processes them in Fifo fashion The second client will wait an unreasonable amount of time for a small transfer Server usually handles more than one request at a time SIE, NTUT, Taiwan
3 CSIE, NTUT, Taiwan Conceptual Server Algorithm Consider file transfer ⚫ First client needs a 200 MB file ⚫ Second client needs a 20 byte file ⚫ If the server processes them in FIFO fashion The second client will wait an unreasonable amount of time for a small transfer Server usually handles more than one request at a time
。。 Concurrent vs. Iterative o Iterative server: one request at a time o Concurrent server: multiple requests at one time o Note: the concurrency is conceptual and generally will use one thread for one request o Concurrent server refers to whether the server permits multiple requests to proceed concurrently, not whether the underlying implementation uses multiple and concurrent threads 4 CSIE. NTUT. Taiwan
4 CSIE, NTUT, Taiwan Concurrent v.s. Iterative Iterative server: one request at a time Concurrent server: multiple requests at one time Note: the concurrency is conceptual and generally will use one thread for one request Concurrent server refers to whether the server permits multiple requests to proceed concurrently, not whether the underlying implementation uses multiple and concurrent threads
●。 Concurrent vs. Iterative o Concurrent servers are difficult to design and build o Why concurrency? o Long delay caused by iterative servers o Performance bottleneck resulted from iterative servers effects many clients 5 SIE NTUT. Taiwan
5 CSIE, NTUT, Taiwan Concurrent v.s. Iterative Concurrent servers are difficult to design and build Why concurrency? ⚫ Long delay caused by iterative servers ⚫ Performance bottleneck resulted from iterative servers effects many clients