How to measure and improve application latency

How to measure and improve application latency

book

Article ID: KB0080621

calendar_today

Updated On:

Products Versions
TIBCO Streaming 7.x, 10.x

Description

How can application latency be measured and decreased in StreamBase?
 

Issue/Introduction

How to measure and improve application latency.

Resolution

In general, we recommend that you measure average round-trip latency by setting up two-way communication between your StreamBase application instance and the remote machine. Two-way communication involves taking timestamp values (using our nanotime() expression language function in a Map operator, for example) when a message is received and again when sending a response message.

The nanotime() function gives you nanosecond accuracy. We actually have a project that measures latency using nanotime() on our Component Exchange.  In Studio, go to File > StreamBase Component Exchange, and search for "latency caliper".  This will load the project into your workspace where you can review the README.txt.

To improve performance, you should profile the application using sbprofile.  For example..
sbprofile -c sbprofile.log
Then analyze the log using the "Analyzing StreamBase Server profile data" project from the Component Exchange.  

Typically, latency performance improvements can be made by increasing the instances of operators  whose tuple processing times are outside of your target values.

You might also want to set streambase.low-latency-mode=true in your sbd.sbconf.  This switch provides a single switch that enables several other properties to direct StreamBase Server to run in low latency configuration. Setting this property to true performs the following subordinate actions:
  • Enables the low latency option on all StreamBase to StreamBase adapters, including those used internally to implement remote container connections.
  • Enables the streambase.tcp-nodelay Java property, which disables the Nagle algorithm on network connections.
  • Sets the Java property streambase.queue-flush-interval to zero, which disables queue flushes for client connections.
  • Sets low latency mode on dequeue output queues.