Class BackendStats
java.lang.Object
express.mvp.myra.transport.BackendStats
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
| Metric | Description | Ideal Value |
|---|---|---|
| syscallReductionRatio | Operations per syscall | > 50x |
| avgBatchSize | Average operations per batch | 32-128 |
| failedSends/Receives | Error counts | 0 |
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for constructingBackendStatsinstances. -
Method Summary
Modifier and TypeMethodDescriptionstatic BackendStats.Builderbuilder()Creates a new builder for constructing stats.doubleReturns the average number of operations per batch.longReturns the number of batch submissions.longReturns the number of failed receive operations.longReturns the number of failed send operations.doubleCalculates the syscall reduction ratio.longReturns the cumulative bytes received.longReturns the cumulative bytes sent.longReturns the total number of completed receive operations.longReturns the total number of completed send operations.longReturns the total number of syscalls made.
-
Method Details
-
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
-