


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



In the previous project, you created a skeletal web proxy server. In this project you will make a proxy server that does something useful. The proxy server will manipulate data in a computation- intensive way, so that under heavy load the bottleneck is not the network but the CPU. Then it makes sense to make the proxy server a distributed program that performs computations on many different machines.
- Read the entire instructions carefully before you start implementing anything! - Degree candidates : There is no margin of late submission. Plan on submitting everything on time. - Keep your code from Project 2! Large parts of Project 2 are orthogonal to this project: the proxy server you are creating here is optimized for different scenarios than that of Project 2. Hence, you should keep both code bases for future use. - You may work in teams as on Project 2, but again you should identify with whom you worked and who contributed what. - In this project you can choose the functionality you want to implement. There is a recom- mended application, but there is also a lot of flexibility. - Don’t get stuck! If something is hard to implement as suggested, approximate it and go on! - If you have any questions, ask me! Use the newsgroup for broad questions.
There is only a single task in this project, but it is quite complex. Part 1, below, describes the func- tionality of your final result. Part 2 discusses the implementation needs for this proxy server. Part 3 outlines the implementation method you should use. Part 4 discusses experimentation.
1. Web Proxy Server Ideas
The end product of this assignment will be a proxy server that performs some useful manip- ulation of web pages for multiple clients. Proxy servers are commonly used for caching web pages, but they can have several more interesting applications. There is a recommended application for this project, but you may want to implement something else. Here are some ideas:
- Shrink images for low-bandwidth links ( recommended application ): Your proxy server can automatically convert all images it receives into a lower-quality format so that they occupy much less space and can be transferred much faster (e.g., over modem lines). For
the purposes of the project, it is sufficient to do this for JPEG images only. You can use an existing library for JPEG image manipulation. I recommend the library by the Indepen- dent JPEG Group (www.ijg.org). I have put a tarfile with the source code under the class web page. To save you some time, I have also added a second tarfile with code that implements a routine reading JPEG data from a file descriptor (file or socket) and storing it in a memory buffer at much lower quality. You may want to modify this routine (it is not the most flexible or efficient code possible but it has been verified to work correctly and can be used as-is for most purposes.
- Encrypting/Decrypting proxy server : You can create a pair of cooperating proxy servers with one encrypting data (e.g., HTML pages) and the other decrypting them. The idea is that these servers could be put on opposite sides of an unsafe network. - Compressing/Decompressing proxy server : You can create a pair of cooperating proxy servers that compress and decompress data automatically for transfer over a slow channel. There are very good compression libraries available that you can use (e.g., Zlib).
In the rest of this handout, I will assume that you are implementing the recommended appli- cation.
2. Performance Requirements
Keep in mind that your proxy server (just like the servers in previous projects) will need to be able to serve multiple clients simultaneously. Although any single connection may be slow (e.g., a modem connection) there can be many of them at once, so the proxy server will need to be scalable both with respect to handling events without blocking and with respect to performing the computation needed. The first requirement is handled by the multi- threaded architecture of your proxy. For the second requirement, consider that your proxy server is now computationally intensive: uncompressing and re-compressing a JPEG file takes nearly as long as transferring it over a slow local area network. Therefore, it makes sense to make the proxy server distributed.
The structure of such a server can be quite simple. The basic multithreaded architecture is preserved, but there will also be entities running on other machines, ready to perform the computationally intensive manipulation. When one of the threads detects that it needs to perform something computationally intensive (e.g., fetch a JPEG file and downgrade it in quality) it should send the parameters for this computation (e.g., the HTTP address of the JPEG file) to one of the distributed entities (e.g., it can pick one at random). The thread should then block, waiting for the results (e.g., the reduced-quality picture data). The dis- tributed entities do not need to be themselves multithreaded because their task is completely CPU bound, so they cannot exploit any concurrency at the hardware level. Nevertheless, the best way to get code that is thread-safe is to declare your distributed entities to be multi- threaded.
decompression/compression process even slower? Vary the JPEG image size from a few KB to several hundred KB and see whether the image size matters. (Because of the way it is written, the JPEG code provided for re-compressing JPEGs at lower quality is likely quite slow when the image does not fit in the CPU cache.) If you find out that this is a problem and you modify the code to address it, you will get another 10% extra credit.
You should turn in the following:
- Your code. Make sure it is obvious how to compile and run everything (i.e., supply a README file and a makefile). Send everything as in Project 2 (email a code archive to the TA and to myself). - A report outlining your design choices and the results of your experiments.