Title: Monitoring and Metering
1Monitoring and Metering
2Learning Objectives
- This module will help you...
- Understand the JXTA monitoring and metering
functionality - Gain familiarity with the JXTA Peer Info Service
API - Understand how to use JXTA monitoring and metering
3Peer Info Protocol
- Provides general framework for obtaining peer
status and monitoring information - Uptime, inbound and outbound message count, time
last message sent/received, etc. - Asynchronous
- Query message sent to peer
- Response message provides specific information
about state of peer - No guarantees peer not required to respond
4Peer Info Service
- Implements the Peer Info Protocol
- Works in context of peergroup
- Provides methods to
- Retrieve remote and local peer status information
- Register a listener that will be notified when
the Peer Info Service receives a response - Flush Peer Info advertisements from local cache
5(No Transcript)
6Monitoring using the JXTA Shell
- The peerinfo command gets information about other
peers within a peergroup - Obtain info about remote peers
- JXTAgt peerinfo -rpeerinfo message sent
- List peer info already known by the peer
- JXTAgt peerinfo
- Flush locally cached peer information
- JXTAgt peerinfo -f
7PeerInfoService
- void addPeerInfoListener(PeerInfoListener
listener) - boolean removePeerInfoListener(PeerInfoListener
listener) - Add/remove a peerinfo listener
- java.util.Enumeration getLocalPeerInfo(ID peer)
- Get PeerInfoservice from local cache
- void getRemotePeerInfo(ID peer, PeerInfoListener
listener) - Get PeerInfoService from a remote peer the
listener object will be called back when peer
information is known - PeerInfoResponseMessage getPeerInfoService()
- Retrieve Peer Info advertisement
- void flushAdvertisements (ID id)
- Flush cached advertisement of specified peer if
id is null, locally cached PeerInfoResponseMessage
of all peers are deleted
8PeerInfo ExampleJava
- Listener interface for receiving PeerInfoService
events - public interface PeerInfoListener extends
java.util.EventListener - Implementing a PeerInfoListener
- PeerInfoListener myPeerListener new
PeerInfoListener() public void
peerInfoResponse(PeerInfoEvent e)
PeerInfoResponseMessage adv e.getPeerInfoRespons
e() if (myQueryID e.getQueryID())
... - peerinfo.addPeerInfoListener(myPeerListener)
int myQueryID peerinfo.getRemotePeerInfo(peer) -
9C API
- Jxta_status peerinfo_service_get_remote_peerinfo
(Jxta_peerinfo_service service, Jxta_id
peerid, Jxta_peerinfo_listener listener) - Get PeerInfoService from a remote peer.
- Jxta_status peerinfo_service_get_local_peerinfo
(Jxta_peerinfo_service service, Jxta_id
peerid, Jxta_object adv) - Get a PeerInfo from local cache.
- Jxta_status peerinfo_service_get_my_peerinfo
(Jxta_peerinfo_service service, Jxta_object
adv) - Retrieve this peer's PeerInfo Advertisement
- Jxta_status peerinfo_service_flush_Advertisement(
Jxta_peerinfo_service service, Jxta_id peerid) - Flush cached advertisement
10C API (continued)
- Jxta_status peerinfo_service_add_peerinfo_listener
(Jxta_peerinfo_service service,
Jxta_peerinfo_listener listener) - Register a peerinfo listener, to be notified on
peerinfo events. - Jxta_status peerinfo_service_remove_peerinfo_liste
ner (Jxta_peerinfo_service service,
Jxta_peerinfo_listener listener) - Remove a peerinfo listener.
11PeerInfo ExampleC
Jxta_PG_get_peerinfo_service(group, peerinfo)
peerinfo_service_get_my_peerinfo(peerinfo,
mypeerinfo_adv) if (mypeerinfo_adv ! NULL
) printf("Obtained d peerinfo
advertisement(s) \n",
mypeerinfo_adv) peerinfo_service_add_peerin
fo_listener(peerinfo,
mylistener) peerinfo_service_get_r
emote_peerinfo(peerinfo, peerId
listener) res
jxta_listener_wait_for_event (listener, timeout,
(Jxta_object) info)
12 Need for Monitoring and Metering
- Perform resource accounting and billing
- Monitor load locally and remotely
- Memory utilization, thread utilization, network
connections, bandwidth - Evaluate various implementations of services
(effects, efficiencies, etc.)
13JXTA Monitoring and Metering Project
Goals
- Provide a simple, dynamic and extendable
framework for gathering and reporting metrics - Increase productivity of JXTA core development
- Provide metrics to help tune/configure
- Provide data to measure scalability
- Help programmers and administrators understand
how JXTA services operate - Provide tools to aid development and debugging
- Provide framework for building special purpose
meterable edge devices
14Monitoring and Metering Tools
- JXTA Service Logger
- Pipes metrics to file for later processing
- JXTA Monitor
- GUI for collecting and rendering data
- Extensible framework
- Displays metrics in tables or graphs
- Can display local or remote results
15JXTA Monitor
16Monitoring and Metering Tool
API View
Get Cumulative Totals MonitorFilter
Register Periodic Listener MonitorFilter
MonitorReport
MonitorReport
Monitor
API View
MonitorManager
SPI View
Meterable JXTAServices
17(No Transcript)
18Monitoring and Metering
Supported Standard Services
- MMP provides J2SE implementations for the
standard JXTA services - Endpoint service
- Transport service
- Rendezvous service
- Resolver service
- Pipe service
- Discovery service
Meterable even though it is not implemented as a
JXTA service.
19Types of Meterable JXTA Builds
- All metering off
- Metering capabilities compiled out of build
- No metering load, smallest JAR
- Metering always on
- Metering capabilities included in library build
- Metering always active
- Metering conditionally on
- Metering capabilities included in library build
- Metering based on setting of user property
- Most flexibility, with slight performance expense
20End Monitoring and Metering