290 likes | 535 Views
IERG 4180 Tutorial 7 Lei Deng 2013-11-06/08. Some Reminders. The due date for Project 3 is 2013-11-17 (next Sunday) Mark Scheme and Demo has been uploaded Office Change: Lei Deng: SHB 826B -> SHB 803. HTTP Web Server Demo. Demo Usage Demo On-Demand Thread Mode. HTTP Web Server Demo.
E N D
Some Reminders The due date for Project 3 is 2013-11-17 (next Sunday) Mark Scheme and Demo has been uploaded Office Change: Lei Deng: SHB 826B -> SHB 803
HTTP Web Server Demo Demo Usage Demo On-Demand Thread Mode
HTTP Web Server Demo Demo Thread-Pool Mode
Web Browser Display Type “localhost:1234” in Firefox
Web Browser Display Click “Introduction”
Web Browser Display Get “Introduction.html”
Web Browser Display Click “Home”
Web Browser Display Get “index.html”
Web Browser Display Click “error page”
Web Browser Display Get “404 status code”
Httperf Test Example Single-Session Example
Httperf Test Example Multi-Session Example
HTTP Web Server Design • Web Browser Behavior • Connect to the web server via TCP • Send request to get the root html file “/”. • Web Server Behavior • Accept Incoming connections • Send the homepage to the web browser after get the requests for URI “/”. • Disconnect the TCP link with the web browser
HTTP Web Server Design • Web Browser Behavior • Click hyperlink to get the html file name • Connect to the web server via TCP • Send request to get the html file, such as “Introduction.html”. • Web Server Behavior • Accept Incoming connections • Send the requested file to the web browser or send 404 status code if the requested file doesn’t exist • Disconnect the TCP link with the web browser
HTTP Web Server Design • On-Demand Thread Mode • Same as in Project 2
HTTP Web Server Design • On-Demand Thread Mode – Each Thread Procudure
HTTP Web Server Design • An Important Tip • In Linux system, thread resources will not be released back to the system when a joinable thread terminates • Either you can use pthread_join() function or set the thread to be detachable such as using pthread_detach() function • A Possible Solution In the Thread #ifndef WIN32 //release resource after thread return automatically pthread_detach(pthread_self()); #endif
HTTP Web Server Design Thread-Pool Mode
HTTP Web Server Design Thread-Pool Mode
HTTP Web Server Design • Thread-Pool Mode • The session thread will not terminate but can block if no item in the queue • Do synchronization • use mutex to protect the queue
HTTP Web Server Design • Requirements • Implement the HTTP protocol so that the web browser (IE, Chrome, Firefox) can visit the web server and get some web pages • Handle the case that the requested web pages are not found in your web server • Run well in both Linux and Windows • Feel free to use the demo web pages or use your own
HttperfOptions • --num-conn=N • N: Total number of connections to create • --wsess=N1, N2, X --burst-length=L • N1: Total number of concurrent sessions • N2: Total number of connections in each session • X: Think-time, i.e., the idle time between two consecutive bursts. • L: Total number of connections in each burst
Httperf Test Requirement • B1: On-Demand Thread Mode in Linux and Windows • Get the response time for the single-session test with different number of connections • e.g. ./NetProbe 1234 o httperf --hog --server localhost --port 1234 --uri /index.html --num-conn 10000
Httperf Test Requirement • B2: Thread-Pool Thread Mode in Linux and Windows • Get the response time for the single-session test with different number of connections and different number of threads • e.g. ./NetProbe 2345 p 4 httperf --hog --server localhost --port 2345 --uri /index.html --num-conn 10000
Httperf Test Requirement • B3: Capacity of On-Demand Thread Mode in Linux and Windows • Get the response time (reply rate, errors) for the multi-session test with different number of concurrent sessions • You can fix each session with such as 100 requests • You can fix think-time such as 0.1 second • e.g. ./NetProbe 1234 o httperf--hog --server localhost --port 1234 --uri /index.html --wsess10,100,0.1
Httperf Test Requirement • B4: Capacity of Thread-Pool Mode in Linux and Windows • Get the response time (reply rate, errors) for the multi-sessiontest with different number of concurrent sessions and different number of threads • You can fix each session with such as 100 requests • You can fix think-time such as 0.1 second • e.g. ./NetProbe 2345 p 4 httperf--hog --server localhost --port 2345 --uri /index.html --wsess10,100,0.1
Performance Metric • The response time, reply rate and errors for the on-demand thread mode and thread-pool mode with given test parameters, the same to all of you. • e.g. • --wsess 100,100,0.1 • Try best to improve the performance for your web server
Submission Requirement VS 2010 solution and Linux source files and/or IDE project files Readme file to instruct us how to compile and run your codes in both Windows and Linux system Httperf Test Document Declaration Form