12
73 Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some of the metrics available. Before looking at the metrics, a basic understanding of the communication between a client and the FTL server is needed. 10.1 Client-Realm Server Communication The connection between a client program and the realm service is established by the tibRealm_Connect() call. Once connected, basic identifying information is exchanged, and the realm service sends the realm definition to the client program. Next the client program sends a HELLO message to the realm service, containing additional identifying information. At this point the client program information appears in the realm service’s list of clients (see Figure 9.3, page 72 for an example). While the client program is running, the realm service periodically sends heartbeat messages to the client program. In a similar manner, the client program periodically sends heartbeat messages to the realm service. Any metrics gathered since the last heartbeat message sent to the realm service are included. A client program’s call to tibRealm_Close() sends a GOODBYE message to the realm service, which causes the realm service to remove that client from its list of clients. The connection to the realm service is then closed. A client program that abnormally terminates (such as via ctrl + C or a fatal error) does not send a GOODBYE message. Instead it is subject to timeouts based on the absence of heartbeat messages before being removed from the realm service’s list of clients. The frequency at which heartbeat messages are sent by either side is determined by the realm properties, which are part of the realm definition. Let’s take a look at these properties. Ensure the FTL server is still running, open a web browser, and navigate to the URL http://localhost:8080. If the realm service login page is displayed, login as you did in Section 6.1, page 27. Bring up the Applications grid by clicking on the link on the left side of the screen. TIBCO FTL R Programming Tutorial

Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

73

Lesson 10: Client Metrics

The realm service web interface makes available metrics as reported by each client program. In this lessonwe’ll look at some of the metrics available.

Before looking at the metrics, a basic understanding of the communication between a client and the FTLserver is needed.

10.1 Client-Realm Server Communication

The connection between a client program and the realm service is established by thetibRealm_Connect() call. Once connected, basic identifying information is exchanged, and the realmservice sends the realm definition to the client program. Next the client program sends a HELLO messageto the realm service, containing additional identifying information. At this point the client programinformation appears in the realm service’s list of clients (see Figure 9.3, page 72 for an example).

While the client program is running, the realm service periodically sends heartbeat messages to the clientprogram. In a similar manner, the client program periodically sends heartbeat messages to the realmservice. Any metrics gathered since the last heartbeat message sent to the realm service are included.

A client program’s call to tibRealm_Close() sends a GOODBYE message to the realm service, whichcauses the realm service to remove that client from its list of clients. The connection to the realm service isthen closed.

A client program that abnormally terminates (such as via ctrl + C or a fatal error) does not send aGOODBYE message. Instead it is subject to timeouts based on the absence of heartbeat messages beforebeing removed from the realm service’s list of clients.

The frequency at which heartbeat messages are sent by either side is determined by the realm properties,which are part of the realm definition. Let’s take a look at these properties.

Ensure the FTL server is still running, open a web browser, and navigate to the URLhttp://localhost:8080. If the realm service login page is displayed, login as you did in Section 6.1,page 27. Bring up the Applications grid by clicking on the link on the left side of the screen.

TIBCO FTL R� Programming Tutorial

Page 2: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

74

Figure 10.1: Applications grid

Along the left side of the screen, the link denoted by the icon and labeled “Realm Properties” displaysthe Realm Properties page. Click it, resulting in a display similar to Figure 10.2.

Figure 10.2: Realm Properties page

We’re interested in the information in the “Intervals” box. Under “Client ! Realm Server”, “Heartbeat”controls how often the client program sends a heartbeat message to the FTL server, while “Timeout”

TIBCO FTL R� Programming Tutorial

Page 3: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

75

determines how much time can pass without the FTL server receiving a heartbeat message from a clientbefore the FTL server removes that client from its list of clients.

Under “Realm Server ! Client”, “Hearbeat” controls how often the FTL server sends a heartbeat messageto all client programs, while “Timeout” determines how much time can pass without the client receiving aheartbeat message from the FTL server before the client attempts to reconnect to the FTL server.

Under “Client Statistics Sampling”, “Client Sampling Interval” controls how often the client programgathers its metrics into a timestamped sample. If “Client Sampling Interval” is smaller than the “Client !Realm Server” heartbeat interval, each heartbeat message sent to the FTL server may contain more thanone sample.

10.2 Run the Samples

In order to look at the client metrics, let’s run the sample client programs from lesson 9. Open a commandwindow, navigate to the $TIBFTL_TUTDIR/code/lesson-09 directory, and start the subscriber. We’llspecify that application “App1” and endpoint “endpoint-1” be used:

./ftlsub -a App1 -e endpoint-1

In another command window, navigate to the same directory and start the publisher. Specify the sameapplication and endpoint names. We’ll also instruct the publisher to send 10000 messages; this will give ussufficient time to look at the metrics.

./ftlpub -a App1 -e endpoint-1 -c 10000

10.3 Examine the Metrics

In the open web browser (which should still be on the Realm Properties page as shown in Figure 10.2), thestatus area should show two active clients. Click anywhere in the status area to expose the StatusDashboard:

TIBCO FTL R� Programming Tutorial

Page 4: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

76

Figure 10.3: Status Dashboard

Click the “Clients” count:

Figure 10.4: Client Status Display

Click anywhere in the row for the subscriber, with the “Client Label” “tibsub”:

TIBCO FTL R� Programming Tutorial

Page 5: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

77

Figure 10.5: Subscriber Details

Metrics are divided into categories. In Figure 10.5, seven categories are shown, each corresponding to oneof the links on the right side: “Client Information”, “Application”, “Endpoint”, “Queues”, “RecentAdvisories”, “Recent Logs”, and “Transport”.

Note that some of these categories will not appear until a heartbeat message containing the client metrics isreceived by the realm service. Since the default client heartbeat interval (as shown in Figure 10.2) is 60seconds, it may take that long before the categories are displayed on your screen.

Expand the “Application” section (by clicking the icon to the left of it) to display the applicationmetrics:

TIBCO FTL R� Programming Tutorial

Page 6: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

78

Figure 10.6: Subscriber Application metrics

Each metrics category contains one or more rows of metric data. Each row is identified by the context itbelongs to; the context name appears under the “Name” column. A context defines a particular instance ofthe category, and its name is established when the corresponding object is instantiated.

Application metrics pertain to the client application as a whole. Thus it makes sense that there is a singlecontext in the “Application” category. The corresponding context name is exactly the application namepassed to tibRealm_Connect(). As an example, refer back to line 75 of Listing 8.4, page 47.

The metrics provided for applications are:

Dynamic Formats The number of named dynamic formats used by the client program.Process Peak RSS (KB) The peak resident set size of the client program (in KB).Process RSS (KB) The current resident set size of the client program (in KB).Process VM (KB) The current amount of virtual memory used by the client program (in KB).System CPU Time (µsec) The amount of system-level CPU time used by the client program (in

µseconds).User CPU Time (µsec) The amount of user-level CPU time used by the client program (in µseconds).Name The application name used by the client in the tibRealm_Connect() call.

To continue, expaned the “Endpoint” section.

TIBCO FTL R� Programming Tutorial

Page 7: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

79

Figure 10.7: Subscriber Endpoint metrics

Each row in the “Endpoint” category corresponds to an endpoint instantiated by a call totib_PublisherCreate() or tib_SubscriberCreate(), and the corresponding name is the endpointname specified in the call. Refer back to line 77 of Listing 8.4, page 47 (for tib_PublisherCreate()),and line 183 of Listing 8.8, page 49 (for tib_SubscriberCreate()) for examples.

The metrics provided for endpoints include:

Msgs Recvd Inbound data messages received through the endpoint.Msgs Sent Outbound data messages sent through the endpoint.Store Mismatch Msgs The number of message flows that result from a store mismatch. This deals with

persistence and is discussed in a later lesson.Name The endpoint name.

Next, expand the “Queues” section.

TIBCO FTL R� Programming Tutorial

Page 8: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

80

Figure 10.8: Subscriber Queue metrics

Each row corresponds to an event queue instantiated by a call to tibEventQueue_Create(). Unlikeother objects, event queues are named via properties; if no properties are passed totibEventQueue_Create(), the FTL library assigns a name.

Three metrics are provided for event queues:

Queue Backlog The maximum number of messages in the event queue during the Client SamplingInterval. Recall from Section 10.1, the Client Sampling Interval is a realm propertywhich controls how often the client program gathers its metrics into a timestampedsamples. After the metrics are gathered, the Queue Backlog is reset; thus the metricreflects the highest value over the interval.

Queue Discards Number of inbound messages discarded by the event queue.Name The event queue name.

To continue, expand the “Transport” section:

TIBCO FTL R� Programming Tutorial

Page 9: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

81

Figure 10.9: Subscriber Transport metrics

Each row in the “Transports” category corresponds to a transport associated with an endpoint used by theclient program.

Four metrics are provided for transports:

Bytes Recvd Inbound data bytes received on the transport.Bytes Sent Outbound data bytes sent on the transport.Data Lost Number of inbound data loss events on the transport. This does not reflect the

number of bytes or messages lost, only the number of discrete loss events.Format Unavailable The number of messages with an unrecognized format received on the transport.

It is important to note that messages sent or received are endpoint metrics, while bytes sent or received aretransport metrics. In addition, even though this is a subscriber, the transport shows non-zero bytes sent.This reflects the data exchange which is part of the initial setup traffic between the publisher and subscriber.

Note the number of messages and bytes received. In Figure 10.9, 127 messages and 48631 bytes werereceived. The numbers on your screen will likely be different.

Now, let’s look at the publisher metrics. Close the client statistics panel by clicking the icon in theupper right corner:

TIBCO FTL R� Programming Tutorial

Page 10: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

82

Figure 10.10: Client status display

Click anywhere in the row for the publisher, with the “Client Label” “tibpub”:

Figure 10.11: Publisher Details

Expand the “Application” section:

TIBCO FTL R� Programming Tutorial

Page 11: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

83

Figure 10.12: Publisher Application Details

Expand the “Endpoint” section:

Figure 10.13: Publisher Endpoint Details

And finally expand the “Transport” section:

TIBCO FTL R� Programming Tutorial

Page 12: Lesson 10: Client Metrics · Lesson 10: Client Metrics The realm service web interface makes available metrics as reported by each client program. In this lesson we’ll look at some

84

Figure 10.14: Publisher Transport Details

Regardless of the role of the client program, the metrics available are essentially the same. The endpointand transport metrics provided are again the same as those provided for the subscriber client program.

TIBCO FTL R� Programming Tutorial