Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 10, 2025

Summary

This PR implements comprehensive benchmarking functionality to compare CLI access (direct file access) vs LiNo protocol server access as requested in issue #31.

🆕 New Features Added

Core Benchmarking Infrastructure

  • LinoProtocolServer.cs: TCP/IP server that processes LiNo queries over network protocol
  • LinoProtocolClient.cs: Client for connecting and sending queries to the LiNo protocol server
  • BenchmarkRunner.cs: Orchestrates performance comparison between CLI and server access methods

CLI Integration

  • Added benchmark subcommand with comprehensive options:
    • --iterations: Number of test iterations per query (default: 10)
    • --warmup: Number of warmup iterations (default: 3)
    • --server-port: Port for benchmark server (default: 8080)
    • --queries: Custom queries to benchmark (uses sensible defaults if not specified)

Testing & Documentation

  • BenchmarkTests.cs: Complete unit test suite for all benchmark components
  • examples/benchmark_demo.sh: Demonstration script showing real-world usage

📊 Benchmark Metrics

The benchmark provides detailed performance analysis including:

  • Latency measurements: Average, minimum, maximum, and median response times
  • Success/failure rates: Tracks operation reliability for both access methods
  • Per-query analysis: Individual performance breakdown for each test query
  • Overall statistics: Aggregate performance comparison

🚀 Usage Examples

Basic benchmark with default settings:

clink benchmark

Custom benchmark configuration:

clink benchmark --iterations 20 --warmup 5 --server-port 8081 --queries "() ((1 1))" "(((\$i: \$s \$t)) ((\$i: \$s \$t)))"

View help:

clink benchmark --help

🔍 Technical Implementation

  • Protocol Design: Uses JSON-based request/response format over TCP for server communication
  • Concurrency Handling: Properly manages database file access conflicts between CLI and server modes
  • Error Handling: Comprehensive error handling and graceful degradation
  • Performance Optimized: Minimal overhead in measurement code to ensure accurate benchmarking

🧪 Test Plan

  • Unit tests for all new components
  • Integration testing with CLI subcommand
  • Performance validation with various query types
  • Concurrent access handling verification
  • Error scenario testing

📝 Issue Resolution

Fixes #31 - Provides the requested benchmarking capability to compare CLI access vs LiNo protocol server access, enabling data-driven decisions about optimal access patterns for different use cases.

The implementation follows the existing codebase patterns and integrates seamlessly with the current CLI infrastructure while adding powerful new benchmarking capabilities.

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #31
@konard konard self-assigned this Sep 10, 2025
konard and others added 2 commits September 10, 2025 15:35
…col server access

This implementation addresses issue #31 by providing comprehensive benchmarking capabilities:

## New Components Added:

### Core Benchmarking Infrastructure:
- **LinoProtocolServer.cs**: TCP/IP server that processes LiNo queries over network
- **LinoProtocolClient.cs**: Client for connecting and sending queries to the server
- **BenchmarkRunner.cs**: Orchestrates performance comparison between CLI and server access

### CLI Integration:
- Added `benchmark` subcommand to main CLI with options for:
  - `--iterations`: Number of test iterations per query (default: 10)
  - `--warmup`: Number of warmup iterations (default: 3)
  - `--server-port`: Port for benchmark server (default: 8080)
  - `--queries`: Custom queries to benchmark (uses defaults if not specified)

### Testing & Demo:
- **BenchmarkTests.cs**: Unit tests for all benchmark components
- **examples/benchmark_demo.sh**: Demonstration script showing usage

## Benchmark Metrics:
- Latency measurements (average, min, max, median)
- Success/failure rates
- Throughput comparison
- Detailed per-query and overall statistics

## Usage:
```bash
clink benchmark --iterations 10 --warmup 3 --server-port 8080
```

The benchmark compares direct file access (CLI) against network protocol access (server)
using the same LiNo query processing engine, providing insights into the performance
trade-offs between local and network-based data access patterns.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Benchmark CLI access vs LiNo protocol server access Implement benchmark functionality to compare CLI access vs LiNo protocol server access Sep 10, 2025
@konard konard marked this pull request as ready for review September 10, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benchmark CLI access vs LiNo protocol server access

2 participants