Class BackendStats

java.lang.Object
express.mvp.myra.transport.BackendStats

public final class BackendStats extends Object
Statistics for I/O backend operations.

This immutable class provides a snapshot of backend performance metrics, including operation counts, throughput, and syscall efficiency.

Key Metrics

Backend Statistics
MetricDescriptionIdeal Value
syscallReductionRatioOperations per syscall> 50x
avgBatchSizeAverage operations per batch32-128
failedSends/ReceivesError counts0

Syscall Reduction

The getSyscallReductionRatio() method returns the ratio of total operations to syscalls. With io_uring batch submission, this should typically be 50-100x, meaning 50-100 I/O operations per syscall.

Usage Example

BackendStats stats = backend.getStats();

System.out.println("Send/Receive: " + stats.getTotalSends()
    + "/" + stats.getTotalReceives());
System.out.println("Throughput: " + stats.getTotalBytesSent() + " bytes sent");
System.out.println("Syscall reduction: "
    + String.format("%.1fx", stats.getSyscallReductionRatio()));
See Also:
  • Method Details

    • builder

      public static BackendStats.Builder builder()
      Creates a new builder for constructing stats.
      Returns:
      a new builder with zero values
    • getTotalSends

      public long getTotalSends()
      Returns the total number of completed send operations.
      Returns:
      send operation count
    • getTotalReceives

      public long getTotalReceives()
      Returns the total number of completed receive operations.
      Returns:
      receive operation count
    • getTotalBytesSent

      public long getTotalBytesSent()
      Returns the cumulative bytes sent.
      Returns:
      bytes sent
    • getTotalBytesReceived

      public long getTotalBytesReceived()
      Returns the cumulative bytes received.
      Returns:
      bytes received
    • getFailedSends

      public long getFailedSends()
      Returns the number of failed send operations.
      Returns:
      failed send count
    • getFailedReceives

      public long getFailedReceives()
      Returns the number of failed receive operations.
      Returns:
      failed receive count
    • getBatchSubmissions

      public long getBatchSubmissions()
      Returns the number of batch submissions.

      For io_uring, this is the number of io_uring_submit() calls.

      Returns:
      batch submission count
    • getAvgBatchSize

      public double getAvgBatchSize()
      Returns the average number of operations per batch.

      Higher values indicate more efficient batching.

      Returns:
      average batch size
    • getTotalSyscalls

      public long getTotalSyscalls()
      Returns the total number of syscalls made.
      Returns:
      syscall count
    • getSyscallReductionRatio

      public double getSyscallReductionRatio()
      Calculates the syscall reduction ratio.

      This is the ratio of total operations (sends + receives) to syscalls. With effective batching, this should be 50-100x.

      Example: If 10,000 operations required 100 syscalls, the ratio is 100x (100-fold syscall reduction).

      Returns:
      the reduction ratio, or 0 if no syscalls have been made