User talk:Storkme/Searching

= Distributed Search = A distributed search query goes something like this:
 * A peer sends query messages to all peers it's connected to, with a set number of hops in the packet. Each peer sends it to all it's connected peers, decrementing the hop count by one. When the hop count reaches zero, the packet is no longer sent on.
 * If a search query returns a match, the peer sends a UDP packet to the original peer containing a byte[] of zero or one representing the list of chunks the peer has.

Advantages

 * Places almost no load on the server.
 * Scalability is insured.
 * Assuming each hop was correct, the search would reach an enormous amount of peers in a relatively short time.

Disadvantages
= Fully Centralized Search = A centralized search is based around the central server. All peers keep the server updated with files (filename + size + hash (+ description?)) they are willing to share.
 * Slower then centralized searchs.
 * No guarantee that all peers will be checked.
 * Search queries are sent to the server which returns a list of files matching the query.
 * Upon choosing a file, the server then:
 * If the peer is visible, instructs a number of peers to connect to the peer and begin the data transfer.
 * If the peer is invisble, gives the peer a list of other peers to connect to and begin data transfer.

Advantages

 * Accurate and pretty fast.

Disadvantages
= Partially Centralized Search = Partially centralized search is where the search query is sent to the server, and the server replicates the query and sends it to every connected peer. It's somewhere between the first two methods.
 * Places a lot of load on the server.
 * Curbs scalability.

Advantages

 * More accurate & faster then a distributed search.
 * Less server load then a fully centralized search.

Disadvantages

 * Scalabilty could be an issue - especially bandwidth wise. Assuming the search query is 30 bytes, sending that to 1,000 connected peers is 30,000 bytes, not including TCP overhead. A few queries per second could max the servers upload speed.