# Presentation: 831896

## A Simple XML Producer-Consumer Protocol

- Warren SmithNASA Ames Research Center
- Dan GunterLawrence Berkeley National Laboratory
- Darcy QuesnelArgonne National Laboratory

## Approach

- Define a relatively simple event protocol
- TCP
- XML
- Implement the protocol
- Provide to the community
- Gain experience
- Improve the protocol
- In this talk: what’s changed

## Ping Event

- Event elements
- SourceHostName: The name of the host performing the ping command.
- TargetHostName: The name of the host being pinged.
- RoundTripTime: The round trip time reported by the ping command in milliseconds.
- TimeStamp: The time the measurement was made.
- Event parameters
- TargetHostName: The name of the host being pinged.
- Period: How often to perform the measurement.

## Ping Event in XML

- Event Parameters
**<Ping xmlns=“http://www.gridforum.org/Performance/EventParameters”>****    <TargetHostname>foo.nas.nasa.gov</TargetHostName>****    <Period units=“min”>2</Period>****</UptimeCPULoad>**** **

- Event
**<Ping xmlns=“http://www.gridforum.org/Performance/Event”>****    <TargetHostName>foo.nas.nasa.gov</TargetHostName>****    <SourceHostName>bar.lbl.gov</SourceHostName>****    <RoundTripTime units=“ms”>7</RoundTripTime>****    <TimeStamp>2000-11-09T21:51:45Z</TimeStamp>****</UptimeCPULoad>**** **

## Protocol Interactions

- Subscription: A request that initiates the transmission of a series of events
- Consumer-initiated subscription
- Consumer subscribes for events from a producer
- Producer sends events to the consumer
- Consumer or producer unsubscribes
- Producer-initiated subscription
- Producer initiates a subscription for a consumer
- Producer sends events to the consumer
- Producer or consumer unsubscribes
- Consumer query
- Consumer asks the producer for an event and producer replies with the event

## General Message Format

- Length (in bytes) as a 32-bit integer in network byte order
- XML tags that indicate the message type: <SubscribeRequest> ... <SubscribeRequest>
- Message specific data inside the tags

## Example Interaction I

- Consumer->Producer
- Producer->Consumer

- <SubscribeRequest xmlns=“http://www.gridforum.org/Performance/Protocol”                               requestID=”2”>    <Ping xmlns=“http://www.gridforum.org/Performance/EventParameters”>        <Period units=“min”>5</Period>        <TargetHostName>bar.lbl.gov</TargetHostName>    </Ping></SubscribeRequest>

- <SubscribeReply xmlns=“http://www.gridforum.org/Performance/Protocol”                            requestID=”2”>    <Return>Success</Return>    <SubscriptionID>1234</SubscriptionID></SubscribeReply>

## Example Interaction II

- Producer->Consumer

- <Event xmlns=“http://www.gridforum.org/Performance/Protocol”             subscriptionID=”1234”>    <Ping xmlns=“http://www.gridforum.org/Performance/Events”>        <SourceHostName>foo.nas.nasa.gov</SourceHostName>        <TargetHostName>bar.lbl.gov</TargetHostName>        <RoundTripTime units=“ms” accuracy=“0.1”>7</RoundTripTime>         <TimeStamp>2000-11-09T21:53:45Z</TimeStamp>    </Ping></Event>

## Example Interaction III

- Consumer->Producer
- Producer->Consumer

- <UnsubscribeRequest xmlns=“http://www.gridforum.org/Performance/Protocol”                                   requestID=”15”>    <SubscriptionID>1234</SubscriptionID></SubscribeRequest>

- <UnsubscribeReply xmlns=“http://www.gridforum.org/Performance/Protocol”                               requestID=”15”>    <Return>Success</Return></SubscribeReply>

## Event Protocol Performance

- 2 independent implementations of protocol
- Java by Dan Gunter
- C++ by Warren Smith
- Encoding/decoding an event message on a 933MHz PIII running RedHat 7.1 with JDK 1.3
- Java
- Encode 21,900 events/sec
- Decode 600 events/sec
- C++
- Encode 28,100 events/sec
- Decode 4,300 events/sec