Testing Inference Performance

Release name: caiman-asr-client-<version>.run

This is a simple client for testing and reporting the latency of the CAIMAN-ASR server. It spins up a configurable number of concurrent connections that each run a stream in realtime.

Running

A pre-compiled binary called caiman-asr-client is provided. ./caiman-asr-client --help lists its options. It takes 16 kHz S16LE single channel wav files.

If you want to run it with many wav files you can use find to list all the wav files in a directory (this will hit a command line limit if you have too many):

./caiman-asr-client $(find /path/to/wav -name '*.wav') --concurrent-connections 1000 --perpetual --quiet

Building

If you want to build the client yourself you need the rust compiler. See https://www.rust-lang.org/tools/install

Once installed you can compile and run it with

$ cargo run --release -- my_audio.wav --perpetual --concurrent-connections 1000

If you want the executable you can run

$ cargo build --release

and the executable will be in target/release/caiman-asr-client.

How the latency is calculated

This client splits the audio in 60ms chunks and sends a chunk every 60ms, so it’s mimicking live audio. The latency is measured by the client, and it is the time from the chunk being sent to the response for that chunk being received. (The CAIMAN-ASR server sends a response for every 60ms chunk it receives, whether or not it has a token for this chunk, so this is always well-defined.)

This means that the reported latency includes the following:

  • The time for the packet to go from the client to the server across the network
  • The time for the chunk to be processed by the server
  • The time for the response to go from the server back to the client.

It doesn’t include:

  • The size of the chunk itself (60ms). If you imagine a live stream of audio that starts at t=0, then at t=60ms the first chunk of audio would be sent. Say that the time taken to receive a response from the server is 50ms, then the first response would be received at 110ms. But we don’t say that the latency is 110ms because we don’t include the size of the chunk in the calculation.

The latency reported by the client is the average and p99 for all the chunks in the previous (configurable) reporting period. The latency reported when the transcription comes back is the average and p99 for all the chunks in that transcription.

To prevent each connection sending audio at the same time, the client waits a random length of time (within the frame duration) before starting each connection. This provides a better model of real operation where the clients would be connecting independently.

Troubleshooting

The client uses a file descriptor for each audio connection. The number of file descriptors available to a process is limited by the operating system. If you see the error Too many open files, you can increase the limit by adding the following lines to /etc/security/limits.conf:

* soft nofile 40000
* hard nofile 40000

You can check the limit with:

ulimit -n