Project Assignment 1 Ying Zhang EECS 489 W07. Clarification Questions for each test Expected output for each test.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

Nonblocking I/O Blocking vs. non-blocking I/O
Sockets Tutorial Ross Shaull cs146a What we imagine Network request… response… The packets that comprise your request are orderly.
Multiplexing/Demux. CPSC Transport Layer 3-2 Multiplexing/demultiplexing application transport network link physical P1 application transport network.
Lecture 2b Sockets Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Transmission Control Protocol (TCP)
I/O Multiplexing Road Map: 1. Motivation 2. Description of I/O multiplexing 3. Scenarios to use I/O multiplexing 4. I/O Models  Blocking I/O  Non-blocking.
Network Server Programming Expression Evaluation Tutorial #10 CPSC 261.
Today’s topic Issues about sending structures with TCP. Server design alternatives: concurrent server and multiplexed server. I/O multiplexing.
COEN 445 Communication Networks and Protocols Lab 4
Socket Programming.
Page: 1 Director 1.0 TECHNION Department of Computer Science The Computer Communication Lab (236340) Summer 2002 Submitted by: David Schwartz Idan Zak.
CSCI 4550/8556 Computer Networks Comer, Chapter 3: Network Programming and Applications.
1 Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write)
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
Programming project #4 1 CS502 Spring 2006 Programming Project #4 Web Server CS-502 Operating Systems Spring 2006.
Programming Project #3CS-4513, D-Term Programming Project #3 Simple Web Server CS-4513 D-Term 2007 (Slides include materials from Operating System.
CS-3103 & CS-502, Summer 2006 Programming Project #31 Programming Project #3 Web Server CS-3103 & CS-502 Operating Systems.
Lecture 8 Epidemic communication, Server implementation.
IP Multiplexing Ying Zhang EECS 489 W07.
Process-to-Process Delivery:
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
Programming Network Servers Topic 6, Chapters 21, 22 Network Programming Kansas State University at Salina.
I/O Systems I/O Hardware Application I/O Interface
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
Introduction to Network Programming Asst. Prof. Chaiporn Jaikaeo, Ph.D. Computer Engineering Department.
Operating Systems Recitation 9, May 19-20, Iterative server Handle one connection request at a time. Connection requests stored in queue associated.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
Review: How to create a TCP end point? What is the right format for sin_port and sin_addr in the sockaddr_in data structure? How many different ways we.
TELE 402 Lecture 4: I/O multi … 1 Overview Last Lecture –TCP socket and Client-Server example –Source: Chapters 4&5 of Stevens’ book This Lecture –I/O.
1 COMP/ELEC 429/556 Introduction to Computer Networks Creating a Network Application Some slides used with permissions from Edward W. Knightly, T. S. Eugene.
1 I/O Multiplexing We often need to be able to monitor multiple descriptors:We often need to be able to monitor multiple descriptors: –a generic TCP client.
Practical Session 12 Reactor Pattern. Disadvantages of Thread per Client It's wasteful – Creating a new Thread is relatively expensive. – Each thread.
I/O Multiplexing. TCP Echo Client: I/O operation is sequential !! tcpcliserv/tcpcli01.c: lib/str_cli.c: TCP Client TCP Server stdin stdout fgets fputs.
Jigsaw Performance Analysis Potential Bottlenecks.
Cs423-cotter1 Concurrency Issues in Client/Server Applications Chapters 15,16, 28.
Single Process, Concurrent, Connection-Oriented Servers (TCP) (Chapter 12)
Silberschatz, Galvin and Gagne  Operating System Concepts Six Step Process to Perform DMA Transfer.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
Acknowledgement: These slides are adapted from slides provided in Thißen & Spaniol's course Distributed Systems and Middleware, RWTH Aachen Processes Distributed.
1 OS Review Processes and Threads Chi Zhang
4P13 Week 9 Talking Points
I/O Multiplexing Chap 6. I/O Models  Blocking I/O Model  Nonblocking I/O Model  I/O Multiplexing Model  Signal Driven I/O Model  Asynchronous I/O.
1 Dimension of Server Designs r Iterative vs Concurrent r Connection-oriented vs. connectionless r Stateful and stateless m Constrained by application.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
I/O Software CS 537 – Introduction to Operating Systems.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Concurrent TCP servers. The basic idea 1 client = 1 task. The task is alive as long until the connection is closed The task closes the connection.
CLIENT (Browser) socket accept C1 C2 recv C2 recv send C2 send end_thread recv C3 send bind connect Web Server Proxy recv close C3 close C2 end_thread.
File I/O. I/O Flags Flags are passed to give some information about how the file is to be used. – Read only file – flag=0x0 – Write only file – flag=0x1.
More Project 1 and HW 1 stuff! Athula Balachandran Wolfgang Richter
Module 12: I/O Systems I/O hardware Application I/O Interface
CSCE 313 Network Socket MP8 DUE: FRI MAY 5, 2017
Client/Server Example
Files I/O, Streams, I/O Redirection, Reading with fscanf
Distributed Systems - Comp 655
Process-to-Process Delivery:
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Server-side Programming CSE 333 Autumn 2018
Server-side Programming CSE 333 Summer 2018
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Concurrency: Processes CSE 333 Summer 2018
Server-side Programming CSE 333 Winter 2019
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Multiplexing We often need to be able to monitor multiple descriptors: a generic TCP client (like telnet) need to be able to handle unexpected situations,
Module 12: I/O Systems I/O hardwared Application I/O Interface
Presentation transcript:

Project Assignment 1 Ying Zhang EECS 489 W07

Clarification Questions for each test Expected output for each test

Project a simple Web server that only serves files. two different I/O models:  select()-based I/O multiplexing (45 points) use select() to serve all clients in a single thread  thread-based blocking I/O. (45 points) pthreads serving each client with its own thread.  documentation (10 points) one to two pages documentation README file

Clarification HTTP file directory: chroot problem The problem is because in many systems usually only the super-user can use it. Because most of you cannot use as super-user, you cannot use chroot. However, the spec requires: disallow clients from access files above the working directory where the server is run So, besides using chroot, you can parse the command line to check whether there are "../file" such character exists. checksum issue First of all, the checksum is hard-coded in the python code. And the calcuation is platform dependent. I have modified the HttpTest.py to set the checksum based on platform. So, you don't need to worry about that. Please download the latest HttpTest.py from the web page. File size In the HTTP spec, you can use "HTTP/1.%d 200 OK\r\nContent-Type: text/html\r\nContent-Length: 1000" to set the file size. However, the filesize is hard-coded in HttpTest.py. So, you don't need to consider how to set the file size for this project because it is not required. connection for Test 3 The problem is because that there is an inconsistency between the HttpTest.py and the project specification. I have changed the connection value for Test3 to be 1000 to make it consistent with the spec.

Questions for each test

select  can use blocking socket  select has three sets read_sets, write_sets, exception_sets FD_ZERO(&rfds); FD_ZERO(&efds); FD_ZERO(&wfds); FD_SET(listen_Sockfd,&rfds); FD_SET(listen_Sockfd,&efds); if (socks[i].state==StateWaitingForRequest) FD_SET(socks[i].sock, &rfds); FD_SET(socks[i].sock, &efds); if (socks[i].state==StateSendingFile) FD_SET(socks[i].sock, &wfds); FD_SET(socks[i].sock, &efds); select(MAX_FDSIZE, &rfds, &wfds, &efds, &to);  protect recv() and send() by using select if (FD_ISSET(socks[i].sock, &rfds))  recv() if (FD_ISSET(socks[i].sock, &wfds))  send()

Data ready Number of bytes is greater than low-water mark for socket receive buffer Read half of the connection is closed(FIN,EOF) Listen socket, incoming connection; Socket error pending

Timeout  Acutally, you need to implete the checking for inactive connections. To do that, you need to remember a time for the client's latest activity and use that to compare with your current time Broken pipe  When sending a file, our code will spontaneously stop, then display "Broken pipe". The python test (#1) ends up throwing a checksum error: signal(SIGPIPE, SIG_IGN);

Test 2 Resource temporally unavailable?  client sequentially send request for a small file, recv file, and close the socket (Phython code GetFile())  server finish sends need to check whether the connection is closed by the client  select(MAX_FDSIZE, &rfds, &wfds, &efds, &to);  for (int i=0;i<ALL_CONNECTIONS;i++)  if (FD_ISSET(socks[i].sock, &rfds))– ready to read because of FIN_received  If(recv() == 0) close_connection()  socket number increased by 2, reaching max 1024 quickly? limit the number of file descriptor used for opening file at a time

Test 3 Connect to the server until the server cannot handle more connections  Set maximum number of connections //check if can accept another connection if (nconn<MAX_CONNECTIONS) Or Select(MAX_CONNECTIONS, &rfds, &wfds, &efds, &to);  Keep persistent connections //get current time time(&curTime); If(curTime-socks[i].timestamp)>=TIMEOUT)  close_connection Rev request:  time(&socks[i].timestamp);

Test 3 avoid blocking in send()  each time send a chunk of file for each connection  select(FD_SETSIZE, &rfds, &wfds, &efds, &to);  for (int i=0;i<CONNECTIONS_WAIT_SNED;i++) if (FD_ISSET(socks[i].sock, &wfds)) Send size  if we are sending an error, file_pos=-1  file and are not done with the file send chuck size  whatever remains in the buffer

Test 5 Maximum number of concurrent slow downloads client send request without recv()  In Python code, DownloadThread() function, check __MAX_IDLE_SECONDS__ (10sec), close

Expected output for each test

Test 1 ############################################################### Test #1: Get a single file from the web server (Simple Correctness) Calculating checksum HttpTest.py:194: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up print "Received file with checksum: %08X, elapsed time: %f seconds" % \ Received file with checksum: 83021ED8, elapsed time: seconds Checksum is correct (PASSED) #Wed Feb 7 16:27: Accepting new connection from client : ##Wed Feb 7 16:27: client :43036 prematurely disconnected.

Test 2 ############################################################### Test #2: Get a small file 2000 times from the web server (Resource de-allocation and latency) Received 2000 files successfully, average request time: milliseconds #Wed Feb 7 16:28: Accepting new connection from client : ##Wed Feb 7 16:28: client :43037 prematurely disconnected. …… ##Wed Feb 7 16:28: Accepting new connection from client : ##Wed Feb 7 16:28: client :43038 prematurely disconnected.

Test 3 ############################################################### Test #3: Connect to the server until the server cannot handle more connections (Scalability) Server handled all 1000 connections without failing ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ##Wed Feb 7 16:29: Accepting new connection from client : ….. ##Wed Feb 7 16:29: client :45037 prematurely disconnected.

Test 4 ############################################################### Test #4: Maximum bandwidth of 100 concurrent downloads (Throughput) Waiting for downloads to complete Test case #4 finished successfully -- Average bandwidth for ~50 MByte transfer: MBits/Second

Test 5 ############################################################### Test #5: Maximum number of concurrent slow downloads (Fairness and scalability) Starting concurrent slow downloads connections in progress when terminated, 0 finished

Test 6 ############################################################### Test #6: Repeatedly connect, send request, then close connection (Resource de- allocation and error handling) Successfully handled 5000 subsequent failed connections (PASSED)