views:

169

answers:

10

Take an image hosting service for example. In order to reduce bandwidth/the number of times you serve images, is it possible to have a client who has just viewed an image then SERVE that same image file (or pieces of that file) to another client who wishes to view the same page/image? Are there security related issues that prevent this from happening or is my lack of understanding of technology preventing me from seeing obvious reasons why this would not work..

If each client served the same amount of data they consumed, the web server would only have to serve any given file one single time and the rest of the bandwidth would be picked up by the clients.

Edit: I am aware of P2P and bittorrents. I am asking, why not apply this concept to general web surfing activity?

+1  A: 

It is called P2P. The most succesful use is bittorrent. It's very good for big files (Linux distros, open office, etc.). Not so efficient for small files.

World of Warcraft patches are delivered by a similar system aswell.

Macha
Peer-to-peer, for those of us who are TLA challenged.
Robert Harvey
But why can't we apply the principle behind torrents to general web surfing activity?
CsharpFused
Bittorrent is a peer-to-peer (P2P) protocol, not "use".
OMG Ponies
BitTorrent requires access to your file system. Web browsers are forbidden from doing this, for security reasons.
Robert Harvey
@harveyBut wouldn't the data also reside in your browsers cache? Is it possible to serve pieces of this data to another client that is requesting the same information without giving them access to your file system?
CsharpFused
Where is the cache stored? (Answer: On disk... in the file system.)
Dave Sherohman
+1  A: 

From the user's perspective, where they get the data is irrelevant so long as it arrives fast, predictably, and securely.

A P2P distribution model is certainly feasible, but it is harder to deliver on those three requirements with P2P compared to client-server.

Frank Krueger
+3  A: 

To "serve" data like this, each client would have to have a server installed on its computer -- and accessible to the world (which is not always easy when you are behind a NAT, a proxy, an entreprise network or whatever).

There are protocols that do that (many Peer to Peer protocols, for instance -- but those work better for big files than for small images, I'd say), but it's just not the way the Web works.

Also, where the data comes from is not what matters to users, as long at is arrives ; and this is your problem, as webmaster/admin.

I should add that with a distributed process like the one you're thinking about, there is a security risk : what if one user decides to send something else than what was really requested ? Say some "not OK" image instead of the real one ? Or a virus ? Or any bad stuff like that ?

Pascal MARTIN
"As long as it arrives" falls into using UDP vs TCP packets for delivery. Gaming uses UDP because it doesn't matter if you lost your movement on a given map while bit/byte order matters when transferring a file of data.
OMG Ponies
+5  A: 

The model you describe is the P2P model, and that's exactly how some protocols (for example, BitTorrent, work).

If you're asking why this kind of protocol isn't used for websites or general purpose interned use, there are probably two main reasons:

  1. It would probably be very difficult to do, technologically: You'd have to be able to redirect clients to each other in a smart way, you'd have to be able to get clients to actually send files (which would require access to their system, something you generally don't have), you'd probably have to take into accounts things like the speed of each client (i.e. you don't want someone on an old, very slow connection serving up images, as your site would look very slow). There are many more reasons, these are just the most immediate problems I can think of, off the top of my head.
  2. It would go over badly with people: Even assuming you could somehow come up with ways of doing this, this kind of thing would probably not go over well with users of your site. Users generally don't want to "share" their computer space/bandwidth/etc. Most times that companies have put "spyware" or other such hidden things on someone's computers, they've gotten very bad publicity.

All in all, I don't think anyone would seriously consider trying to do something like this, mostly for the two reasons I outlined above.

Edan Maor
Correct - I am asking why this isn't done for websites.regarding # 2);Advantages to users:A) bandwidth bills would be reduced, the site would not need to serve nearly as many advertisements.B) the site might scale better = less downtime. C) Although this is a tangent, the complete absence of a central server might provide some comfort to people whose sites are being blocked by someone else - eg: a revolutionary website being blocked by a totalitarian countryD) People seem to respond favorably to crowdsourcing where they feel they are making a difference - think SETI@home, recaptcha, etc.
CsharpFused
Even if you could get it working technically, and have all those benefits, I still think you would be incredibly hard-pressed to get people to understand all that. SETI@home, while popular, is probably known to only a small fraction of the online population. Just try getting *every* user to your site to install something, for the very vague claim of "it will have websites have less advertising".As for recaptcha, that is easy to force users to use, and besides, I don't think most people even know that it's for a good cause, they just know they have to enter the words to get into a site.
Edan Maor
Thats true. I was wondering if it would be possible to do without requiring that a user go through an installation process and interrupt their browsing experience. Web servers read a small amount of data from your browser already, why not send a little more data and make it available to other clients, in small encrypted pieces?
CsharpFused
+2  A: 

Peer-to-peer networking only works for static content, due to complications with keeping a given file in sync.

OMG Ponies
+1  A: 

P2P is pretty well covered in the other answers but an additional concern is current infrastructure. For consumer class Internet access (cable, DSL, etc) outgoing bandwidth is usually only a fraction of incoming. For example cable download speeds can often be 5-6 Mbps, but upload speeds are often in the 400K range or less.

Internet carriers designed the system this way since most people download content in browsers or other applications and generate a smaller amount of content.

Ah, this is interesting. But if clients were only able to upload a small amount of information, wouldn't this be better than none? Most web pages and images are much less than 400kb unless it is a high resolution image or a video.
CsharpFused
The rate is still much lower, so the user on the receiving end would be getting a fraction of the bandwidth of a server coming from a server even if the object was less than 400k. Also if DSL was used instead of cable, it might be only 40-60K. This adds to the challenge of building a consistent user experience on P2P.
+2  A: 

For several reasons:

  • Clients tend to be behind NAT, which prohibits serving data directly to other clients.
  • Clients tend to have poorer connectivity than servers.
  • You can't rely on a given client having suitable available bandwidth, or actually serving what they claim they will. If you care about how your users experience your site, you want to make sure the content is served quickly, not catch-as-catch-can.
  • You need a way to verify that the data you're getting hasn't been modified by the client you are getting it from (or the client they got it from, and so on) - this would require digital signatures, which would imply all the same issues and hassles as SSL.
  • It would require major reworking of HTTP (if not an outright redesign) to support this. Client support would be spotty at best, especially with little incentive to clients to support it.
Nick Johnson
A: 

You'd have to have something running in the background on someone's computer to serve up whatever content someone else is requesting. How would you get around the spam potential as each client has to say, "Yes, I have that," or "No, I don't have that," which would be some traffic possibly.

Another point not mentioned, is that some sites wouldn't want to let their images out into the public,e.g. porn sites come to mind, so not everyone would want this.

JB King
A: 

With a little UDP magic, the Adobe Flash Player is now able to lash together with other clients in an ad hoc P2P network. It uses some fairly interesting network chat to punch holes through NAT setups.

http://labs.adobe.com/wiki/index.php/Stratus%3AFAQ

http://en.wikipedia.org/wiki/Real%5FTime%5FMedia%5FFlow%5FProtocol

http://www.adobe.com/devnet/flashplayer/articles/rtmfp%5Fstratus%5Fapp.html

http://www.flashrealtime.com/tuts/p2p-in-flash.html

spender
A: 

For most internet applications, the slowest part of the network is the final link to the user's machine. So client P2P has some use - those cases where the server bandwidth/number of users is worse than the last mile bandwidth - but doesn't necessarily work for other cases.

There's an interesting lecture on techniques to avoid duplication of information in routers by Van Jacobson using another level of reference over those in TCP/IP.

Pete Kirkham