PropertyDamage.Nemesis.PacketLoss (PropertyDamage v0.2.0)

View Source

Simulate packet loss in network communication.

Randomly drops a percentage of network packets, useful for testing retry logic, idempotency, and message delivery guarantees.

Configuration

  • :loss_percent - Percentage of packets to drop (0-100, default: 10)
  • :duration_ms - How long packet loss persists (default: 5000ms)
  • :target - Specific service/host to affect (default: :all)

Usage with Toxiproxy

context = %{toxiproxy: %{proxy_name: "api", api_url: "http://localhost:8474"}}

Example

def commands do
  [
    {SendMessage, weight: 5},
    {PropertyDamage.Nemesis.PacketLoss, weight: 1}
  ]
end

Testing Behavior

With packet loss, your system should:

  • Retry failed requests appropriately
  • Handle partial failures gracefully
  • Maintain consistency despite lost messages