Skip to main content

PeerAdvertisement duration and readvertisement.

12 replies [Last post]
senapathy
Offline
Joined: 2006-10-16

When a Peer first connects to the JXTA network, it publishes a PeerAdvertisement. The Advertisement has a limited expiration time. If the Peer is to remain active for a very long time, does the Peer need to periodically (same as experiation time) re-advertise it's presence in the network? This is done by publish() and remotePublish()?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tra
Offline
Joined: 2003-06-16

> I come back on this topic because it's very
> interesting to me: I have experienced the following
> behaviour, when i use the remotePublish() to publish
> an Advertisement on a RendezVous Peer.
> [code]
> myDiscoSvc.remotePublish(rdvPeerID,
> peerAdvertisement, 30*sec);
> [/code]
> has the effect of publishing the peerAdvertisement on
> the Rdv for the specified Expiration Time; the
> problem is that PeerAdvertisements published (NOT
> remotePublished) by other peers are no more
> discovered by an external Peer that performs a search
> passing through the Rdv.
This indicates that not all your edge peers are correctly
configured and connected to the RDV. This should
work without having you use remotePublish.

B.
> While with
> [code]
> myDiscoSvc.remotePublish(peerAdvertisement, 30*sec);
> [/code]
> the external Peer does't find the Peer that has
> remotePublished, otherwise it finds all the Peers
> that just published.
>
> [code]
> [/code]
>
> So this is my thought about this issue:
> [code]
> remotePublish(String peerid, Advertisement adv, long
> expiration) [/code]
> stores ONCE the advertisement in the specified Peer's
> cache. If this Peer is the Rdv, it will respond with
> only this Advertisement to any query it receives
> (like getRemoteAdvertisements())
>
> [code]
> [/code]
>
> [code]
> remotePublish(Advertisement adv, long expiration)
> [/code]
> doesn't store the advertisement in the specified
> Peer's cache but only the index (like the
> publish()).
> So, if this Peer is the Rdv, an external Peer that
> uses this Rdv to perform some queries manages to find
> all the peers (but not the peer that has performed
> only a remotePublish()).
>
> [code]
> [/code]
>
> I know that this queston is not very clear, but it
> reflects the confusion i have on this matter :-)
>
> [code]
> [/code]
>
> Thanks in advance for answering
>
> [code]
> [/code]
>
> ciao
>
> [code]
> [/code]
>
> pietro
>
> [code]
> [/code]
> [b] P.S. There is a problem in indenting the
> messages, bacause i cannot start a new line if i
> quote a previous message[/b]

pietro78
Offline
Joined: 2007-01-31

> This indicates that not all your edge peers are
> correctly
> configured and connected to the RDV. This should
> work without having you use remotePublish.

I'm quite sure that all my edge peers are connected to the RDV Peer because they wait for the completion of this method:

[code]
private synchronized void connectedRendezdVous() {
System.out.println("Checking if connected to a RendezVous...");
int i = 0;
while (!rdvSvc.isConnectedToRendezVous()){
System.out.println("Waiting for a RendezVous connection. Attempt number: " + i);
i++;
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Enumeration en = rdvSvc.getConnectedRendezVous();
while (en.hasMoreElements()) {
PeerID element = (PeerID) en.nextElement();
System.out.println("Connected to RendezVous: " + element);
rdvPeerID = element.toString();
}
}
[/code]

I have also set the "Act as a Relay" option in the RdvPeer configuration, and I have set all the edge Peers to use the RdvPeer also as a relay, but the behaviour hasn't changed:
- if edgePeerA makes a publish(), the Monitoring Peer discovers it for the entire LifeTime
- if edgePeerA makes a publish() and edgePeerB makes a remotePublish() the Monitoring Peer discovers only edgePeerA for the entire LifeTime
- if edgePeerA makes a publish() and edgePeerC makes a remotePublish(RdvPeerID, ..., ...) the Monitoring Peer discovers only edgePeerC and only for its ExpTime; after this time the Monitoring Peer discovers again edgePeerA.

So it seems to me that the remotePublish() works only if you specify the PeerID, and it should be used only if you want to "force" the PeerAdvertisement to be stored on another peer's cache.

Note that in my examples i never use Pipes and PipeAdverisements, only PeerAdvertisement.

ciao

pietro

pietro78
Offline
Joined: 2007-01-31

> You don't need to republish your peer advertisement. This is done by the platform. Also, when you publish advertisements you don't need to use "remotePublish". This call should only be used if you want a full copy of the advertisement on the RDVs.

I come back on this topic because it's very interesting to me: I have experienced the following behaviour, when i use the remotePublish() to publish an Advertisement on a RendezVous Peer.
[code]
myDiscoSvc.remotePublish(rdvPeerID, peerAdvertisement, 30*sec);
[/code]
has the effect of publishing the peerAdvertisement on the Rdv for the specified Expiration Time; the problem is that PeerAdvertisements published (NOT remotePublished) by other peers are no more discovered by an external Peer that performs a search passing through the Rdv.

[code]
[/code]

While with
[code]
myDiscoSvc.remotePublish(peerAdvertisement, 30*sec); [/code]
the external Peer does't find the Peer that has remotePublished, otherwise it finds all the Peers that just published.

[code]
[/code]

So this is my thought about this issue:
[code]
remotePublish(String peerid, Advertisement adv, long expiration) [/code]
stores ONCE the advertisement in the specified Peer's cache. If this Peer is the Rdv, it will respond with only this Advertisement to any query it receives (like getRemoteAdvertisements())

[code]
[/code]

[code]
remotePublish(Advertisement adv, long expiration) [/code]
doesn't store the advertisement in the specified Peer's cache but only the index (like the publish()).
So, if this Peer is the Rdv, an external Peer that uses this Rdv to perform some queries manages to find all the peers (but not the peer that has performed only a remotePublish()).

[code]
[/code]

I know that this queston is not very clear, but it reflects the confusion i have on this matter :-)

[code]
[/code]

Thanks in advance for answering

[code]
[/code]

ciao

[code]
[/code]

pietro

[code]
[/code]
[b] P.S. There is a problem in indenting the messages, bacause i cannot start a new line if i quote a previous message[/b]

pietro78
Offline
Joined: 2007-01-31

I try di depict the configuration I'm using in order to clarify the situation described in my previous post:

M <-----> { Rdv <------> pool of eP }

- a RendezVous Peer (Rdv) on a machine with a public IP address
- a pool of edge Peers (ePs) in a LAN behind a NAT that can only communicate with the just mentioned RendezVous (and in which I have DISABLED multicast)
- a "Monitoring Peer" (M) running on a external machine (with a public IP address), that peridically performs queries to the RendezVous for discovering which edge Peer in the pool is on.

pietro

tra
Offline
Joined: 2003-06-16

> I try di depict the configuration I'm using in order
> to clarify the situation described in my previous
> post:
>
> M <-----> { Rdv <------> pool of eP }
>
> - a RendezVous Peer (Rdv) on a machine with a public
> IP address
> - a pool of edge Peers (ePs) in a LAN behind a NAT
> that can only communicate with the just mentioned
> RendezVous (and in which I have DISABLED multicast)
Did you configure a relay service on your Rendezvous
and enable "use relay" on all the edge?

B.

> - a "Monitoring Peer" (M) running on a external
> machine (with a public IP address), that peridically
> performs queries to the RendezVous for discovering
> which edge Peer in the pool is on.
>
> pietro

papelito
Offline
Joined: 2007-01-11

How to change th expiratio lifetime for Peer and PerGroups Advs? I don't see any methods to do this...

pietro78
Offline
Joined: 2007-01-31

You can change the expiration time and the lifetime when you publish() or remotePublish() the adv.
Actually i don't know how to "create" an adv with a specific Exp Time and Lifetime, because when you perform
[code] groupAdv = myPeerGroup.getPeerGroupAdvertisement(); [/code]
or
[code] peerAdvertisement = myPeerGroup.getPeerAdvertisement(); [/code]
you cannot set custom values.

ciao

pietro

tra
Offline
Joined: 2003-06-16

> You can change the expiration time and the lifetime
> when you publish() or remotePublish() the adv.
This is the way you do it. Just re-publish
the advertisement with the nex expiration and
life time.

B.

> Actually i don't know how to "create" an adv with a
> specific Exp Time and Lifetime, because when you
> perform
> [code] groupAdv =
> myPeerGroup.getPeerGroupAdvertisement(); [/code]
> or
> [code] peerAdvertisement =
> myPeerGroup.getPeerAdvertisement(); [/code]
> you cannot set custom values.
>
> ciao
>
> pietro

pietro78
Offline
Joined: 2007-01-31

I have the same problem :-)
If a Peer would die, how long its PeerAdvertisement will remain in other peers' cache? Does the RendezVous provide a sort of "hartbeat" for the PeerGroup?
I know that these are general questions, but they are very useful to me...

tra
Offline
Joined: 2003-06-16

> I have the same problem :-)
> If a Peer would die, how long its PeerAdvertisement
> will remain in other peers' cache? Does the
> RendezVous provide a sort of "hartbeat" for the
> PeerGroup?
> I know that these are general questions, but they are
> very useful to me...

First question: You don't need to republish your peer advertisement. This
is done by the platform. Also, when you publish advertisements you don't need to use "remotePublish". This
call should only be used if you want a full copy of the advertisement on the RDVs.

Second Question: Currently peer advertisements are kept in
your ./jxta/CM persistent store for I think 3 months from the last time you started your peer. You don't need to do anything as the platform manages the peer advertisement. You can certainly change the default value. Check the default expiration time.

RDVs uses a lease management protocol which maintains
an heartbeat with edge peers.

Hth,

B.

pietro78
Offline
Joined: 2007-01-31

Hi tra,
thanks for answering...

>
> First question: You don't need to republish your peer
> advertisement. This
> is done by the platform. Also, when you publish
> advertisements you don't need to use "remotePublish".
> This
> call should only be used if you want a full copy of
> the advertisement on the RDVs.

Ok, so is the PeerAdvertisement automatically re-published or re-RemotePublished only when the lifetime expires? Or it is done in a smaller interval?

>
> Second Question: Currently peer advertisements are
> kept in
> your ./jxta/CM persistent store for I think 3 months
> from the last time you started your peer. You don't
> need to do anything as the platform manages the peer
> advertisement. You can certainly change the default
> value. Check the default expiration time.
>
> RDVs uses a lease management protocol which maintains
> an heartbeat with edge peers.

So could the Rendezvous Peer be used as a sort of Monitoring Peer for the Peer Group? And if so, are only lifetime and expiration time the parameters to play with? I mean:
- Peer A publishes its PeerAdvertisement to the Rdv Peer
- the Rdv Peer stores the PeerAdvertisement in its local cache until the end of Expiration Time (set by Peer A)
- Peer A dies before its Expiration Time
- Peer B searchs Peer A using Rdv Peer

Does Peer B find Peer A? Rdv Peer continues to maintain Peer A's adv for all the Expiration time?
How often does the Rdv Peer check the "validity" of the Advs in its Local Cache?

I'm sorry for annoying you with these questions, but this is an issue that is really not clear to me...

thanks in advance

ciao

tra
Offline
Joined: 2003-06-16

> Hi tra,

> Ok, so is the PeerAdvertisement automatically
> re-published or re-RemotePublished only when the
> lifetime expires? Or it is done in a smaller
> interval?
Everytime you restart the peer, there is a change in
your network connectivity and when the lifetime expires.

> So could the Rendezvous Peer be used as a sort of
> Monitoring Peer for the Peer Group?
Yes, so you may want to check the presence project if you
are looking for a tighly coupled presence management.

>And if so, are
> only lifetime and expiration time the parameters to
> play with?
No, The edge and the RDV use a lease management protocol to
keep track of edge peer connectivity.

I mean:
> - Peer A publishes its PeerAdvertisement to the Rdv
> Peer
> - the Rdv Peer stores the PeerAdvertisement in its
> local cache until the end of Expiration Time (set by
> Peer A)
> - Peer A dies before its Expiration Time
> - Peer B searchs Peer A using Rdv Peer
>
> Does Peer B find Peer A?
You may be able to find the peer A advertisement if another
peer knows about A, or if B had known A before as Peer B
will have cached Peer A advertisement.

>Rdv Peer continues to
> maintain Peer A's adv for all the Expiration time?
No if you just use publish and not remotePublish. If you
just publish, RDVs only maintain indexes and these indexes
are flushed as soon as the RDV detects the edge is gone.

> How often does the Rdv Peer check the "validity" of
> the Advs in its Local Cache?
There is a background CM thread that checks expiration every
2 or 5 minutes.

hth,

B.
>
> I'm sorry for annoying you with these questions, but
> this is an issue that is really not clear to me...
>
> thanks in advance
>
> ciao