All Classes Namespaces Files Functions Pages
Migrating to API v2

Counters of Triggers

Basic counters of triggers

In the old API the counters where returned in key-value lists. e.g. You needed to parse the list before you could retrieve your value

1 set resultList [ $trigger Counters.Get ]
2 puts $resultList

Returns:

NrOfFrames 84 

using foreach {name value} or lindex it was possible to extract that result.

1 set packetCount [ lindex $resultList 1 ]

In API 2.x we've changed that to result objects. This allows you to get the value of the counter directly whitout the need of parsing a list. These result object contain also other resultmetrics that help in understanding what you measure e.g. framesizeMin and framesizeMax

1 set triggerResult [ $trigger Result.Get ]
2 $triggerResult Refresh
3 set packetCount [ $triggerResult PacketCount.Get ]
4 set byteCount [ $triggerResult ByteCount.Get ]

In order to retrieve new counters you call the refresh method. Rx.Trigger.Basic.ResultData is the resultObject from a BasicTrigger.

History result

New in 2.x API are the History Results. Each second we create 2 counter snapshots, one Cumulative and one Interval snapshot. Only the last 6 snapshots are kept in memory at server-side and can be requested. These results are useful to create some statitics over time.

1 set resultHistory [ $trigger Result.History.Get ]

The resulting ResultHistory object contains two lists of counter result objects. One list for the Cumulative snapshots and one containing the Interval snapshots. Each time you refresh this object, it will request up to 6 snapshots for each type from the server and are stored localy. The Clear method on the ResultHistory object will erase the local stored snapshots.

Refreshing and history continuity

The result history is maintained locally and updated when the Refresh method is called.

By default, the server is configured with a sampling interval duration of 1 second and a sampling buffer length of 6 snapshot. The server maintains the last 6 snapshots of 1 second. So it can buffer the results for 6 seconds. If the server buffer runs full, it will drop the oldest result as a consequence.

When the user obtains the results after the server's buffer became full, the snapshots older than current time minus 6 seconds will be lost. The local history will then have a gap between previous refresh time and current time minus 6 seconds.

As a user, you probably want to have a continuous history of results, without any gaps in time. It is up to the user to make sure that the results are obtained before the buffer of the server runs full.

By default, the refresh interval should be smaller than 6 seconds. Because of timing issues when working at the edge, we advise to keep the refresh interval lower than 5 seconds. The Tcl-HL examples mainly use a refresh interval of 1 second.

A refresh interval less than the sampling interval duration is pretty useless since it will only update the last snapshot in the history (which holds the current counters). The history is normally only used to see the evolution over time or e.g. for generating graphs. So these are processed at the end of the test. The current counters are of no use here, so it is not necessary to have such a high refresh rate then.

Note
Since version 2.3.0 of the client and server, it is possibible to configure the sampling interval duration and sampling buffer length. When playing around with these values, you must check your scripts that the refresh interval stays lower than the total buffer duration.

Clearing result and result history

For consistency in method naming we obviously also changed the method call to clear the results. In the old API, we used the method name

1 $trigger Counters.Clear

In API 2.x, we changed this to

1 $trigger Result.Clear

Counters of transmission-related objects

This relates to the frame blasting related objects: Streams and Frames .

The changes are very similar to the changes for Counters of Triggers .

Basic counters of transmission-related objects

In the old API the counters where returned in key-value lists. e.g. You needed to parse the list before you could retrieve your value

1 set resultList [ $stream Counters.Brief.Get ]
2 puts $resultList

Returns:

NrOfFramesSent 8462 ByteBlower_FrameOid1 4231 ByteBlower_FramOid2 4231 

using lrange and foreach {frameOid value} or lindex it was possible to extract that result.

1 set packetCount [ lindex $resultList 1 ]

In API 2.x we've changed that to result objects. This allows you to get the value of the counter directly whitout the need of parsing a list. These result object contain also other resultmetrics that help in understanding what you measure e.g. framesizeMin and framesizeMax

1 set streamResult [ $stream Result.Get ]
2 $streamResult Refresh
3 set packetCount [ $streamResult PacketCount.Get ]
4 set byteCount [ $streamResult ByteCount.Get ]

In order to retrieve new counters you call the refresh method. Tx.Stream.ResultData is the resultObject from a Tx.Stream.

History result

New in 2.x API are the History Results for Streams and Frames . Each second we create 2 counter snapshots, one Cumulative and one Interval snapshot. Only the last 6 snapshots are kept in memory at server-side and can be requested. These results are usefull to create some statitics over time.

1 set resultHistory [ $stream Result.History.Get ]

The resulting ResultHistory object contains a 2 lists of stream result objects. One list for the Cumulative snapshots and one containing the Interval snapshots. Each time you refresh this object, it will request up to 6 snapshots for each type from the server and are stored localy. The Clear method on the ResultHistory object will erase the local stored snapshots.

Refreshing and history continuity

The result history is maintained locally and updated when the Refresh method is called.

By default, the server is configured with a sampling interval duration of 1 second and a sampling buffer length of 6 snapshot. The server maintains the last 6 snapshots of 1 second. So it can buffer the results for 6 seconds. If the server buffer runs full, it will drop the oldest result as a consequence.

When the user obtains the results after the server's buffer became full, the snapshots older than current time minus 6 seconds will be lost. The local history will then have a gap between previous refresh time and current time minus 6 seconds.

As a user, you probably want to have a continuous history of results, without any gaps in time. It is up to the user to make sure that the results are obtained before the buffer of the server runs full.

By default, the refresh interval should be smaller than 6 seconds. Because of timing issues when working at the edge, we advise to keep the refresh interval lower than 5 seconds. The Tcl-HL examples mainly use a refresh interval of 1 second.

A refresh interval less than the sampling interval duration is pretty useless since it will only update the last snapshot in the history (which holds the current counters). The history is normally only used to see the evolution over time or e.g. for generating graphs. So these are processed at the end of the test. The current counters are of no use here, so it is not necessary to have such a high refresh rate then.

Note
Since version 2.3.0 of the client and server, it is possibible to configure the sampling interval duration and sampling buffer length. When playing around with these values, you must check your scripts that the refresh interval stays lower than the total buffer duration.

Clearing result and result history

For consistency in method naming we obviously also changed the method call to clear the results. In the old API, we used the method name

1 $stream Counters.Clear

In API 2.x, we changed this to

1 $stream Result.Clear

Counters of ByteBlowerPort

The changes are very similar to the changes for Counters of Triggers .

Tx and Rx Counters of ByteBlowerPort

In the old API the counters where returned in key-value lists. e.g. You needed to parse the list before you could retrieve your value

1 set resultList [ $port Counters.Get ]
2 puts $resultList

Returns:

RcvNrOfFrames 468 SendNrOfFrames 218 RcvNrOfUndersized 0 RcvNrOfOversized 3 RcvRate 4 SendRate 12 

using foreach {name value} or lindex it was possible to extract that result.

1 set rxPacketCount [ lindex $resultList 1 ]

In API 2.x we've changed that to result objects. This allows you to get the value of the counter directly whitout the need of parsing a list. These result object contain also other resultmetrics that help in understanding what you measure e.g. framesizeMin and framesizeMax

The Tx counters for a ByteBlowerPort have been dropped. There were generally unused. All relevant tx counters in streams, frames and protocols are now available in their related result objects. Therefore the Tx counters on a ByteBlowerPort have minimal added value.

The counters have further been split up in

Rx.Broadcast
broadcast counters
Rx.Unicast
unicast counters
Rx.All
counters for all incoming traffic
1 set portResult [ $port Result.Get ]
2 $portResult Refresh
3 set portAllResult [ $portResult Rx.All.Get ]
4 set rxPacketCount [ $portAllResult PacketCount.Get ]
5 set rxByteCount [ $portAllResult ByteCount.Get ]

In order to retrieve new counters you call the refresh method. ByteBlowerPort.ResultRxData is the resultObject from a ByteBlowerPort's receive counters.

History result

New in 2.x API are the History Results. Each second we create 2 counter snapshots, one Cumulative and one Interval snapshot. Only the last 6 snapshots are kept in memory at server-side and can be requested. These results are usefull to create some statitics over time.

1 set resultHistory [ $port Result.History.Get ]

The resulting ResultHistory object contains a 2 lists of ByteBlowerPort result objects. One list for the Cumulative snapshots and one containing the Interval snapshots. Each time you refresh this object, it will request up to 6 snapshots for each type from the server and are stored localy. The Clear method on the ResultHistory object will erase the local stored snapshots.

Refreshing and history continuity

The result history is maintained locally and updated when the Refresh method is called.

By default, the server is configured with a sampling interval duration of 1 second and a sampling buffer length of 6 snapshot. The server maintains the last 6 snapshots of 1 second. So it can buffer the results for 6 seconds. If the server buffer runs full, it will drop the oldest result as a consequence.

When the user obtains the results after the server's buffer became full, the snapshots older than current time minus 6 seconds will be lost. The local history will then have a gap between previous refresh time and current time minus 6 seconds.

As a user, you probably want to have a continuous history of results, without any gaps in time. It is up to the user to make sure that the results are obtained before the buffer of the server runs full.

By default, the refresh interval should be smaller than 6 seconds. Because of timing issues when working at the edge, we advise to keep the refresh interval lower than 5 seconds. The Tcl-HL examples mainly use a refresh interval of 1 second.

A refresh interval less than the sampling interval duration is pretty useless since it will only update the last snapshot in the history (which holds the current counters). The history is normally only used to see the evolution over time or e.g. for generating graphs. So these are processed at the end of the test. The current counters are of no use here, so it is not necessary to have such a high refresh rate then.

Note
Since version 2.3.0 of the client and server, it is possibible to configure the sampling interval duration and sampling buffer length. When playing around with these values, you must check your scripts that the refresh interval stays lower than the total buffer duration.

Clearing result and result history

For consistency in method naming we obviously also changed the method call to clear the results. In the old API, we used the method name

1 $port Counters.Clear

In API 2.x, we changed this to

1 $port Result.Clear

HTTP/TCP

TCP Congestion Avoidance Algorithm (CAA)

ByteBlower currently supports 3 Congestion Avoidance Algorithms.

  • None
  • NewReno
  • Sack

In API 1.8.x you could also select serverDefault as CAA. When this was selected, the server would use its default CAA. This changed over releases and thus CAA depended on the version of ByteBlower server software. In 2.x API we've droped this. Now you have to explicitly define your CAA. You need thus to select one of the CAA above and change your code to

1 $HTTPClient Tcp.CongestionAvoidance.Algorithm.Set "Sack"

HTTP yet finished

To know if a httpsession is still active we had to write something like this.

1 while { [ string equal [ $httpClientSessionInfo Tcp.Status.Get ] "active" ] || [ string equal [ $httpClientSessionInfo Tcp.Status.Get ] "unavailable" ]} {
2  ## Perform whatever was needed while the http session was still running
3 
4  }

We had to check the Tcp.Status and decide if the tcp was still active. depending on the returned status values. In 2.x we've simplified this. The client will decide if the Http is done. So you only need to check if the method Layer5.Http.Client::Finished.Get returns True or False

1 while { ![ $httpClient Finished.Get ]} {
2  ## Perform whatever was needed while the http session was still running
3 
4  }

HTTP session counters

In the 1.x API the counters of a HTTPSession where stored in the SessionInfo object of HTTP.

1 set httpServerSessionInfo [ $httpServerSession Http.Session.Info.Get $clientID ]
2 #- Tx side info (server)
3 set txBytes [ $httpServerSessionInfo Tcp.Tx.Bytes.Get ]
4 #- Rx side info (client)
5 set rxBytes [ $httpClientSessionInfo Rx.Bytes.Get ]
6 set avgThroughput [ $httpClientSessionInfo AverageDataSpeed.Get ]

Like with the triggers we've introduced here also the concept of result objects. These contain the relevant counters in a consistened way. You need to refresh this resultObject to get the new counters. This has as advantage that all the counters are taken on the same moment in time and thus correlate with each other. The names for the different counters are also consistent with those of the Triggers.

1 #- Tx side info (server)
2 set httpServerSessionInfo [ $httpServerSession Http.Session.Info.Get $clientID ]
3 set txResult [ $httpServerSessionInfo Result.Get ]
4 $txResult Refresh
5 
6 set txBytes [ $txResult Tx.ByteCount.Total.Get ]
7 
8 #- Rx side info (client)
9 set $httpClientSessionInfo [ $httpClientSession Http.Session.Info.Get ]
10 set rxResult [ $httpClientSessionInfo Result.Get ]
11 $rxResult Refresh
12 
13 set rxBytes [ $rxResult Rx.ByteCount.Total.Get ]
14 set elapsedSeconds [ expr [ $rxResult Rx.Timestamp.Last.Get ] - [ $rxResult Rx.Timestamp.First.Get ] ]
15 
16 if { $elapsedSeconds} {
17  set avgThroughput [ expr $rxBytes / $elapsedSeconds ]
18 } else {
19  set avgThroughput 0
20 }

TCP SessionInfo

Where we had before a mixture of HTTP counters and TCP Counters in our HttpSessionInfoObject

1 # HttpSessionInfo Object
2 set httpServerSessionInfo [ $httpClientSession Http.Session.Info.Get ]
3 
4 # TCP metrics
5 set minCongestion [ $httpClientSessionInfo Tcp.ReceiveWindow.Size.Minimum.Get ]
6 set maxCongestion [ $httpClientSessionInfo Tcp.ReceiveWindow.Size.Maximum.Get ]

We now have split those up in there separete SessionInfo objects. The Layer5.Http.SessionInfo object has a link to its Layer4.Tcp.SessionInfo object. This new object contains all the information about the underlying TCP session. The counters for this TCPSession are again stored in a result object Layer4.Tcp.ResultSnapshot

1 # Get the HttpSessionInfo oject from the HTTPClient
2 set httpClientSessionInfo [ $httpClient Http.Session.Info.Get ]
3 
4 # Get the TcpSessionInfo object
5 set tcpClientSessionInfo [ $httpClientSessionInfo Tcp.Session.Info.Get ]
6 
7 # TcpSessionInfo result object, containing the TCP counters
8 set tcpResult [ [ $httpClientSessionInfo Tcp.Session.Info.Get ] Result.Get ]
9 set minCongestion [ $tcpResult CongestionWindow.Minimum.Get ]
10 set maxCongestion [ $tcpResult CongestionWindow.Maximum.Get ]

IGMP and MLD

We've made the API of IGMP and MLD consistent in methods so it's clear how to use these classes. In the 1.x API, you had to specify the version of the IGMP-session with a parameter.

1 set layer3Protocol [ $destPort Layer3.IPv4.Get ]
2 
3 # Create a IGMPv2 session and join
4 set igmpSession [ $layer3Protocol Protocol.Igmp.Join -address 225.6.6.6 -version 2 ]

In the 2.x API we've simplified this API. The method name reflects the version of the session that you will add. In IGMP and in MLD we've used the same syntax for adding a session. This is easier to use and remember.

1 set layer3Protocol [ $destPort Layer3.IPv4.Get ]
2 
3 # Create IGMP protocol
4 set igmpProtocol [ $layer3Protocol Protocol.Igmp.Get ]
5 
6 # Create a IGMPv2 session
7 set $multicastGroup "225.6.6.6"
8 set igmpSession [ $igmpProtocol Session.V2.Add $multicastGroup ]
9 
10 # Join the session
11 $igmpSession Join

The complete new API for IGMP can be found here Layer4.Igmp and for MLD here Layer4.Mld}

Capture

The frames returned by a Rx.Capture.RawPacket is also placed in a result object. Where Frames.Get returned a nested list of frames, Result.Get returns a list of Rx.Capture.Frame objects. Using the method provided you now can easly retrieve the bytes whitout the need for parsing the list. This was the 1.x way.

1 set capturedFrames [ $capture Frames.Get ]
2 # Get the bytes of the first frame
3 set bytes [ lindex [ lindex capturedFrames 0 ] 4 ]

In our API2.x this is the prefered way to retrieve the bytes of the first captured frame

1 set captureResult [ $capture Result.Get ]
2 
3 # list of the captured frames
4 set capturedFrames [ $captureResult Frames.Get ]
5 
6 # the first frame
7 set firstFrame [ lindex capturedFrames 0 ]
8 
9 # the bytes of the first frame
10 set bytes [ $firstFrame Bytes.Get ]