Discovery to Exhaustion

More often than the seasons change someone will ask one of the following seemingly unrelated questions on the JXTA mailing lists or IRC :
  • I published an advertisement and my friend tried searching for it. He can't find my advertisement. Why?
  • How can I find the advertisements for all peers?
  • I searched for advertisements but always get the same ones. Why?
  • I searched for advertisements from two different peers using the same query but got different results . Why?
The answers to these questions can all be related back to the goal of JXTA Discovery--"Get me some advertisements which match this query". The fundamental purpose of JXTA Discovery is to solve only this single problem.

Ok, so that's what JXTA Discovery does. Sounds very reasonable. How does it impact the preceding question? The first thing to understand is that JXTA Discovery is incredibly lazy. Even lazier than your dead-beat brother-in-law. JXTA Discovery does only the absolute minimum amount of work needed to satisfy the goal "Get me some advertisements which match this query."

JXTA Discovery's laziness isn't actually laziness, it is efficiency (yes, I know, your brother-in-law says that too). By minimizing the amount of work done to satisfy each query JXTA Discovery limits the amount of networking resources consumed and the processing required by other peers. If all peers behave in a similar way, the result is that the network load for Discovery is minimized.

The key word in understanding how and when JXTA Discovery minimizes its effort in satisfying queries is "some". Saying that JXTA Discovery is only responsible for providing "some" results in response to queries provides JXTA Discovery with a lot of flexibility. JXTA Discovery never claims to offer the complete result to a query. It also never claims to offer a specific result to a query unless there is only a single result possible.

JXTA Discovery's goal of returning some advertisements for each query does imply a promise to return advertisements, if available, in response to all valid queries. JXTA Discovery tries hard to always return a result, if possible, for each query. Depending on how narrow or broad your query is the "quality" of the set of results will vary. The varying quality of the results can be related back to Discovery's efforts to minimize the work that it does. JXTA Discovery does allow you to issue unqualified queries for advertisements. These queries offer JXTA Discovery the broadest opportunity to be lazy and generally return the lowest quality and most incomplete results. Generally, if you find that the advertisements that JXTA Discovery is returning are not the ones you want or expect then you should be asking a different and more specific question.

Now with that background and context, how about some direct answers to the questions we began with:

I published an advertisement and my friend tried searching for it. He can't find my advertisement. Why?
Your friend is probably not searching specifically for your advertisement but instead for all advertisements of the same type. You should not expect that JXTA Discovery will return a specific advertisement (your advertisement) in response to a generic request.
How can I find the advertisements for all peers?
You can't and shouldn't ever need to find all instances of any advertisement. JXTA Discovery does not promise to ever return exhaustive results in response to a query. If it is hard to understand why JXTA Discovery doesn't allow this, consider what would happen if there were 1 zillion peers on the network. The amount of effort required to respond to your query, assuming that your peer could even handle the response, would bring the network to it's knees. JXTA Discovery won't allow you to do this. Additionally, there are also issues related to the network's dynamic nature which make enumerating all of anything nearly impossible anyway.
I searched for advertisements but always get the same ones. Why?
JXTA Discovery is likely being lazy (efficient). Your query is probably generic enough that the results returned satisfy the "some results" requirement while allowing JXTA Discovery to do a minimal amount of work. This type of problem can usually be resolved by issuing a more specific Discovery query.
I searched for advertisements from two different peers using the same query but got different results . Why?
This question has the same answer as the previous question. In addition, you should not expect a specific result to any Discovery query unless the query has only one answer. In particular, it's likely that different peers will see different results to the same query.

Summarizing the important ideas about JXTA Discovery that you should remember. JXTA Discovery is not a database. It does not provide exhaustive (complete) responses to queries though it will try to return some results if any exist. JXTA Discovery is generally not deterministic. You cannot depend upon JXTA Discovery to return a specific result to any query unless that query has only one answer.

Comments:

Post a Comment:
Comments are closed for this entry.
About

mduigou

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today