1. SYSTEM ANALYSIS 1.1 project description Mostly ‘clients’ are the machines or programs that request services from another machine or server on the network. The server is linked to databases or the Web and performs the processing of the request and the delivery of the respond. It is Multithreaded so many clients can access the web through this Web Proxy Server. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server. Problem statement: We go for proxy server is a server (a computer system or an application program) that acts as an intermediary for requests seeking resources from other servers. we connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server Web Proxy is a very simple HTTP proxy server written as a console application and as a windows service. So we go for JSON method to download Internet Information Server (IIS) is a World Wide Web server, IIS means that you can publish WWW pages. . 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1. SYSTEM ANALYSIS
1.1 project description Mostly ‘clients’ are the machines or programs that request services from
another machine or server on the network. The server is linked to databases or the Web and
performs the processing of the request and the delivery of the respond. It is Multithreaded so
many clients can access the web through this Web Proxy Server. A client connects to the
proxy server, requesting some service, such as a file, connection, web page, or other resource,
available from a different server.
Problem statement:
We go for proxy server is a server (a computer system or an
application program) that acts as an intermediary for requests seeking resources from other
servers. we connects to the proxy server, requesting some service, such as a file, connection,
web page, or other resource, available from a different server Web Proxy is a very simple
HTTP proxy server written as a console application and as a windows service. So we go for
JSON method to download Internet Information Server (IIS) is a World Wide Web server,
IIS means that you can publish WWW pages. .
We rigorously prove that both spatial heterogeneity (same machine
act as a client and same machine act as a server) and temporal correlations in service capacity
increase the download time in networks and then analyze a simple, distributed algorithm to
effectively remove these negative factors, thus minimizing the download time.
1
MODULES:
Creates a connection to the remote server (remote websites)
Creates a request with the some data. (HTTP handler)
Sends the request to the remote server and returns the
response.
Compare Regular and Stream Proxy server.
Algorithms Specification
JSON (the serialization of data in JavaScript object notation) is an increasingly
popular data format, largely because it is easy to parse (or, in the case of JavaScript, simply
evaluate) into a data structure of the consumer's programming language of choice. This is a
specification for a resource-centric serialization of RDF in JSON. It aims to serialize RDF in
a structure that is easy for developers to work with.
Syntax Specification
RDF/JSON represents a set of RDF triples as a series of nested data structures. Each
unique subject in the set of triples is represented as a key in JSON object (also known as
associative array, dictionary or hash table). The value of each key is a object whose keys are
the URIs of the properties associated with each subject. The value of each property key is an
array of objects representing the value of each property.
Implementation is the most crucial stage in achieving a successful system and giving
the user’s confidence that the new system is workable and effective. Implementation of a
modified application to replace an existing one. This type of conversation is relatively easy to
handle, provide there are no major changes in the system.
Each program is tested individually at the time of development using the data and has
verified that this program linked together in the way specified in the programs specification,
the computer system and its environment is tested to the satisfaction of the user. The system
that has been developed is accepted and proved to be satisfactory for the user. And so the
system is going to be implemented very soon. A simple operating procedure is included so
that the user can understand the different functions clearly and quickly.
Initially as a first step the executable form of the application is to be created and
loaded in the common server machine which is accessible to the entire user and the server is
to be connected to a network. The final stage is to document the entire system which provides
components and the operating procedures of the system.
Implementation is the stage of the project when the theoretical design is turned out
into a working system. Thus it can be considered to be the most critical stage in achieving a
successful new system and in giving the user, confidence that the new system will work and
be effective.
The implementation stage involves careful planning, investigation of the existing
system and it’s constraints on implementation, designing of methods to achieve changeover
and evaluation of changeover methods.
Implementation is the process of converting a new system design into operation.
It is the phase that focuses on user training, site preparation and file conversion for installing
40
a candidate system. The important factor that should be considered here is that the conversion
should not disrupt the functioning of the organization.
TESTING
Testing is the process of running a system with the intention of finding errors. It enhances the
integrity of a system by detecting deviations in design and errors in the system, and by
detecting error-prone areas. Testing also adds value to the product by conforming to the user
requirements.
Testing is essential to ensure:
Software quality
Software reliability
System assurance
Performance and capacity utilization
Testing is a part of Verification and Validation.
Verification: Are we building the system right?
Validation: Are we building the right system?
1. Verification: is the checking or testing of items, including software, for conformance
and consistency by evaluating the results against pre-specified requirements.
[Verification: Are we building the system right?]
2. Error Detection: Testing should intentionally attempt to make things go wrong to
determine if things happen when they shouldn’t or things don’t happen when they
should.
41
3. Validation: looks at the system correctness – i.e. is the process of checking that what
has been specified is what the user actually wanted. [Validation: Are we building the
right system?]
TYPES OF TESTING
BLACK BOX TESTING A system or component whose inputs, outputs and general functions are known, but
whose contents or implementation is unknown or irrelevant.
Black box testing techniques
Equivalence partitioning
Boundary value analysis
WHITE BOX TESTING
It is also called as “Structural Testing” or “Logic-driven Testing” or “Glass Box
Testing” or “Clear Box testing”
In this source code is available for Testing
Structural Testing process
Program Logic-driven Testing
Design-based Testing
Examines the internal structure of program
White box testing techniques
Basis path testing
Flow graph notation
Cyclomatic complexity
Various level of Testing
1. Unit Testing
2. Functionality Testing
3. Integration Testing
42
4. System Testing
UNIT TESTING
Unit testing focuses verification efforts on the smallest unit of the software design, the
module. This is also known as “Module Testing”. The modules are tested separately. This
testing was carried out during programming stage itself. In this testing each module is found
to be working satisfactorily as regards to the expected output from the module.
INTEGRATION TESTING
Data can be lost across an interface; one module can have adverse efforts on another.
Integration testing is the systematic testing for construction of program structure, while at the
same time conducting tests to uncover errors associated within the interface. Here correction
is difficult because the isolation of cause is complication by the cast expense of the entire
program. Thus in the integration testing step, all the errors uncovered are corrected for the
next testing steps. This evaluate the interaction and consistency of interacting components
.
Integration testing techniques are
a. Top-Down Integration
b. Bottom-up Integration
VALIDATION TESTING
At the conclusion of integration testing, software is completely assembled as a
package, interfacing errors have been uncovered and corrected and a final series of software
tests begins validation tests begin. Validation test can be tested defined in many ways. After
validation test has been conducted, one of the two possible conditions exists.
One is the function or performance characteristics confirm to specification and are accepted
and the other is deviation from specification is uncovered and a deficiency list is created.
43
OUTPUT TESTING
After performance validation testing, the next step is output testing o the proposed
system since no system could be useful if it does not produce the required output in a specific
format. Asking the users about the format required by them tests the outputs generated by the
system under consideration. Here, the output format is considered in two ways, one is on the
screen and the other is printed format. The output format on the screen is found to be correct
as the format was designed in the system design phase according to the user needs. For the
hard copy also the output comes as the specified requirements by the user. Hence output
testing does not result any correction in the system.
USER ACCEPTANCE TESTING
User acceptance testing of a system is the key factor of the success of any system. The
system under study is tested for the user acceptance by constantly keeping in touch with the
prospective system users at any time of developing and making changes wherever required.
44
6. FUTURE ENHANCEMENT
Here, we have designed a new distributed algorithm namely dynamically distributed
parallel periodic switching (D2PS) that effectively removes the negative factors of the
existing parallel downloading, chunk based switching, periodic switching, thus minimizing
the average download time.
There are two schemes
Parallel Permanent Connection, and
Parallel Random Periodic Switching in our dynamically distributed
parallel periodic switching (D2PS) method. In our Parallel Permanent
Connection, the downloader randomly chooses multiple source peers
and divides the file randomly into chunks and download happens in
parallel for the fixed time slot t and source selection function does not
change for that fixed time slot.
45
7. APPENDIX
7.1 sample coding:
Regular-proxy:
using System;using System.Web;using System.Web.Caching;using System.Net;using ProxyHelpers;public class RegularProxy : IHttpHandler { public void ProcessRequest (HttpContext context) { string url = context.Request["url"]; int cacheDuration = Convert.ToInt32(context.Request["cache"] ?? "0"); string contentType = context.Request["type"];
// We don't want to buffer because we want to save memory context.Response.Buffer = false; // Serve from cache if available if (cacheDuration > 0) { if (context.Cache[url] != null) { context.Response.BinaryWrite(context.Cache[url] as byte[]); context.Response.Flush(); return; } }
using (new TimedLog("RegularProxy\t" + url)) using (WebClient client = new WebClient()) { if (!string.IsNullOrEmpty(contentType)) client.Headers["Content-Type"] = contentType; client.Headers["Accept-Encoding"] = "gzip"; client.Headers["Accept"] = "*/*"; client.Headers["Accept-Language"] = "en-US"; client.Headers["User-Agent"] = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
46
byte[] data; using( new TimedLog("RegularProxy\tDownload Sync") ) { data = client.DownloadData(url); }
if( cacheDuration > 0 ) context.Cache.Insert(url, data, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(cacheDuration), CacheItemPriority.Normal, null); if (!context.Response.IsClientConnected) return; // Deliver content type, encoding and length as it is received from the external URL context.Response.ContentType = client.ResponseHeaders["Content-Type"]; string contentEncoding = client.ResponseHeaders["Content-Encoding"]; string contentLength = client.ResponseHeaders["Content-Length"];
if (!string.IsNullOrEmpty(contentEncoding)) context.Response.AppendHeader("Content-Encoding", contentEncoding); if (!string.IsNullOrEmpty(contentLength)) context.Response.AppendHeader("Content-Length", contentLength);
if (cacheDuration > 0) HttpHelper.CacheResponse(context, cacheDuration); else HttpHelper.DoNotCacheResponse(context); // Transmit the exact bytes downloaded using (new TimedLog("RegularProxy\tResponse Write " + data.Length)) { context.Response.OutputStream.Write(data, 0, data.Length); context.Response.Flush(); } } } public bool IsReusable { get { return false; } }
}
47
Stream – proxy:
using System;using System.Diagnostics;using System.Threading;using System.Web;using System.Net;using System.IO;using System.IO.Compression;using System.Web.Caching;using ProxyHelpers;
Log.WriteLine("--- " + url + " ----"); if (cacheDuration > 0) { if (context.Cache[url] != null) { CachedContent content = context.Cache[url] as CachedContent;
if (!string.IsNullOrEmpty(content.ContentEncoding)) context.Response.AppendHeader("Content-Encoding", content.ContentEncoding); if (!string.IsNullOrEmpty(content.ContentLength)) context.Response.AppendHeader("Content-Length", content.ContentLength); context.Response.ContentType = content.ContentType; content.Content.Position = 0; content.Content.WriteTo(context.Response.OutputStream); }
48
}
using (new TimedLog("StreamingProxy\t" + url)) { HttpWebRequest request = HttpHelper.CreateScalableHttpWebRequest(url); // As we will stream the response, don't want to automatically decompress the content // when source sends compressed content request.AutomaticDecompression = DecompressionMethods.None;
if (!string.IsNullOrEmpty(contentType)) request.ContentType = contentType;
using (new TimedLog("StreamingProxy\tTotal GetResponse and transmit data")) using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { this.DownloadData(request, response, context, cacheDuration); } } } public bool IsReusable { get { return false; } }
private void DownloadData(HttpWebRequest request, HttpWebResponse response, HttpContext context, int cacheDuration) { MemoryStream responseBuffer = new MemoryStream(); context.Response.Buffer = false;
try { if (response.StatusCode != HttpStatusCode.OK) { context.Response.StatusCode = (int)response.StatusCode; return; } using (Stream readStream = response.GetResponseStream()) { if (context.Response.IsClientConnected) { string contentLength = string.Empty; string contentEncoding = string.Empty; ProduceResponseHeader(response, context, cacheDuration, out contentLength, out contentEncoding);
using (new TimedLog("StreamingProxy\tResponse Flush")) { context.Response.Flush(); } } } catch (Exception x) { Log.WriteLine(x.ToString()); request.Abort(); } }
private int TransmitDataInChunks(HttpContext context, Stream readStream, MemoryStream responseBuffer) { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead; int totalBytesWritten = 0;
50
using( new TimedLog("StreamingProxy\tTotal read from socket and write to response") ) while ((bytesRead = readStream.Read(buffer, 0, BUFFER_SIZE)) > 0) { using (new TimedLog("StreamingProxy\tWrite " + bytesRead + " to response")) context.Response.OutputStream.Write(buffer, 0, bytesRead); responseBuffer.Write(buffer, 0, bytesRead);
_PipeStream = new Utility.PipeStreamBlock(10000); //_PipeStream = new Utility.PipeStream(10000); byte[] buffer = new byte[BUFFER_SIZE];
// Asynchronously read content form response stream Thread readerThread = new Thread(new ThreadStart(this.ReadData)); readerThread.Start(); //ThreadPool.QueueUserWorkItem(new WaitCallback(this.ReadData));
// Write to response int totalBytesWritten = 0; int dataReceived;
byte[] outputBuffer = new byte[BUFFER_SIZE]; int responseBufferPos = 0; using (new TimedLog("StreamingProxy\tTotal read and write")) { while ((dataReceived = this._PipeStream.Read(buffer, 0, BUFFER_SIZE)) > 0) { // if about to overflow, transmit the response buffer and restart int bufferSpaceLeft = BUFFER_SIZE - responseBufferPos;
if (bufferSpaceLeft < dataReceived) { Buffer.BlockCopy(buffer, 0, outputBuffer, responseBufferPos, bufferSpaceLeft);
using (new TimedLog("StreamingProxy\tWrite " + BUFFER_SIZE + " to response")) { context.Response.OutputStream.Write(outputBuffer, 0, BUFFER_SIZE); responseBuffer.Write(outputBuffer, 0, BUFFER_SIZE); totalBytesWritten += BUFFER_SIZE; }
// Initialize response buffer and copy the bytes that were not sent responseBufferPos = 0; int bytesLeftOver = dataReceived - bufferSpaceLeft; Buffer.BlockCopy(buffer, bufferSpaceLeft, outputBuffer, 0, bytesLeftOver); responseBufferPos = bytesLeftOver; }
// If some data left in the response buffer, send it if (responseBufferPos > 0) { using (new TimedLog("StreamingProxy\tWrite " + responseBufferPos + " to response")) { context.Response.OutputStream.Write(outputBuffer, 0, responseBufferPos); responseBuffer.Write(outputBuffer, 0, responseBufferPos); totalBytesWritten += responseBufferPos; } } }
private void ProduceResponseHeader(HttpWebResponse response, HttpContext context, int cacheDuration, out string contentLength, out string contentEncoding) { // produce cache headers for response caching if (cacheDuration > 0) HttpHelper.CacheResponse(context, cacheDuration); else HttpHelper.DoNotCacheResponse(context);
// If content length is not specified, this the response will be sent as Transfer-Encoding: chunked contentLength = response.GetResponseHeader("Content-Length"); if (!string.IsNullOrEmpty(contentLength)) context.Response.AppendHeader("Content-Length", contentLength);
// If downloaded data is compressed, Content-Encoding will have either gzip or deflate contentEncoding = response.GetResponseHeader("Content-Encoding"); if (!string.IsNullOrEmpty(contentEncoding)) context.Response.AppendHeader("Content-Encoding", contentEncoding);
if (cacheDuration > 0) { if (context.Cache[url] != null) { // We have response to this URL already cached SyncResult result = new SyncResult(); result.Context = context;
54
result.Content = context.Cache[url] as CachedContent; return result; } }
HttpWebRequest request = HttpHelper.CreateScalableHttpWebRequest(url); // As we will stream the response, don't want to automatically decompress the content // when source sends compressed content request.AutomaticDecompression = DecompressionMethods.None;
if (!string.IsNullOrEmpty(contentType)) request.ContentType = contentType;
public void EndProcessRequest(IAsyncResult result) { if (result.CompletedSynchronously) { // Content is already available in the cache and can be delivered from cache SyncResult syncResult = result as SyncResult; syncResult.Context.Response.ContentType = syncResult.Content.ContentType; syncResult.Context.Response.AppendHeader("Content-Encoding", syncResult.Content.ContentEncoding); syncResult.Context.Response.AppendHeader("Content-Length", syncResult.Content.ContentLength);
syncResult.Content.Content.Seek(0, SeekOrigin.Begin); syncResult.Content.Content.WriteTo(syncResult.Context.Response.OutputStream); } else { // Content is not available in cache and needs to be downloaded from external source AsyncState state = result.AsyncState as AsyncState; state.Context.Response.Buffer = false; HttpWebRequest request = state.Request;
using (HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse) { this.DownloadData(request, response, state.Context, state.CacheDuration); } }
55
} }
7.1 Screen Shots:
Screen: Plain http- regular method
56
Screen: Plain HTTP to Stream
57
Screen: JSON to Regular
58
Screen: JSON to Stream
59
Screen: File downloading
60
Screen: report
61
8. CONCLUSION
In this paper we have focused on the average download time of each user in a P2P
network. With the devastating usage of network resources by P2P applications in the current
Internet, it is highly desirable to improve the network efficiency by reducing each user’s
download time. In contrast to the commonly-held practice focusing on the notion of average
capacity, we have shown that both the spatial heterogeneity and the temporal correlations in
the service capacity can significantly increase the average download time of the users in the
network, even when the average capacity of the network remains the same.
62
BIBLIOGRAPHY
ASP.NET & C#: A Programmer's Introduction to C#, 2nd edition (Apress) - Eric Gunnerson
Component-Based Development with Visual C# (M&T books) - Ted Faison
Microsoft ASP.NET Step by Step (Microsoft Press) - G. Andrew Duthrie
Deploying and Managing Microsoft .NET Web Farms (Sams) - Barry Bloom