This directory contains an experimental resource adapter for running complex experiments with Semian.
The ExperimentalResource class simulates a distributed service with multiple endpoints, each with configurable latencies following statistical distributions. This allows for testing various failure scenarios and performance characteristics.
- Multiple Endpoints: Configure any number of endpoints, each with its own fixed latency
- Statistical Distributions: Latencies are assigned based on statistical distributions
- Currently supports: Log-normal distribution
- Latency Bounds: Set minimum and maximum latency constraints
- Fixed Latencies: Each endpoint gets a fixed latency at initialization for consistent behavior
- Request Timeouts: Configure a maximum timeout for requests
- Requests that would exceed the timeout sleep for the timeout period then raise an exception
- Useful for simulating real-world timeout behavior
- Baseline Error Rate: Configure a probability of request failure
- Requests fail randomly based on the configured error rate
- Failed requests throw
RequestErrorexceptions after partial processing
- Service-Wide Degradation: Degrade the entire service with optional ramp-up time
- Latency degradation: Add fixed latency to all requests
- Error rate changes: Modify error rate for the entire service
- Gradual ramp-up: Both degradations support gradual transitions over time
See example_with_circuit_breaker.rb for usage:
bundle install
bundle exec ruby example_with_circuit_breaker.rb
Output:
