public Throttle(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction, float rateMBit) { _node = node; _target = target; _direction = direction; _rateMBit = rateMBit; }
private bool Throttle(ThrottleTransportAdapter.Direction direction, ThrottleMode mode) { var rootBAddress = new Address("akka", "systemB", "localhost", RootB.Address.Port.Value); var transport = Sys.AsInstanceOf <ExtendedActorSystem>().Provider.AsInstanceOf <RemoteActorRefProvider>().Transport; var task = transport.ManagementCommand(new SetThrottle(rootBAddress, direction, mode)); task.Wait(TimeSpan.FromSeconds(3)); return(task.Result); }
public static Proto.Msg.InjectFailure.Types.Direction Direction2Proto(ThrottleTransportAdapter.Direction dir) { switch (dir) { case ThrottleTransportAdapter.Direction.Send: return(Proto.Msg.InjectFailure.Types.Direction.Send); case ThrottleTransportAdapter.Direction.Receive: return(Proto.Msg.InjectFailure.Types.Direction.Receive); case ThrottleTransportAdapter.Direction.Both: default: return(Proto.Msg.InjectFailure.Types.Direction.Both); } }
public static TCP.Direction Direction2Proto(ThrottleTransportAdapter.Direction dir) { switch (dir) { case ThrottleTransportAdapter.Direction.Send: return(Direction.Send); case ThrottleTransportAdapter.Direction.Receive: return(Direction.Receive); case ThrottleTransportAdapter.Direction.Both: default: return(Direction.Both); } }
private Task <SetThrottleAck> SetMode(ThrottlerHandle handle, ThrottleMode mode, ThrottleTransportAdapter.Direction direction) { if (direction == ThrottleTransportAdapter.Direction.Both || direction == ThrottleTransportAdapter.Direction.Send) { handle.OutboundThrottleMode.Value = mode; } if (direction == ThrottleTransportAdapter.Direction.Both || direction == ThrottleTransportAdapter.Direction.Receive) { return(AskModeWithDeathCompletion(handle.ThrottlerActor, mode, ActorTransportAdapter.AskTimeout)); } else { return(Task.FromResult(SetThrottleAck.Instance)); } }
/// <summary> /// Creates a new SetThrottle message. /// </summary> /// <param name="address">The address of the throttle.</param> /// <param name="direction">The direction of the throttle.</param> /// <param name="mode">The mode of the throttle.</param> public SetThrottle(Address address, ThrottleTransportAdapter.Direction direction, ThrottleMode mode) { _address = address; _direction = direction; _mode = mode; }
/// <summary> /// Switch the Helios pipeline of the remote support into pass through mode for /// sending and/or receiving. /// /// ====Note==== /// To use this feature you must activate the failure injector and throttler /// transport adapters by specifying `testTransport(on = true)` in your MultiNodeConfig. /// </summary> /// <param name="node">is the symbolic name of the node which is to be affected</param> /// <param name="target">is the symbolic name of the other node to which connectivity shall be impeded</param> /// <param name="direction">can be either `Direction.Send`, `Direction.Receive` or `Direction.Both`</param> /// <returns></returns> public Task <Done> PassThrough(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction) { return(Throttle(node, target, direction, -1f)); }
/// <summary> /// Switch the helios pipeline of the remote support into blackhole mode for /// sending and/or receiving: it will just drop all messages right before /// submitting them to the Socket or right after receiving them from the /// Socket. /// /// ====Note==== /// To use this feature you must activate the failure injector and throttler /// transport adapters by specifying `testTransport(on = true)` in your MultiNodeConfig. /// </summary> /// <param name="node">is the symbolic name of the node which is to be affected</param> /// <param name="target">is the symbolic name of the other node to which connectivity shall be impeded</param> /// <param name="direction">can be either `Direction.Send`, `Direction.Receive` or `Direction.Both`</param> /// <returns></returns> public Task <Done> Blackhole(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction) { return(Throttle(node, target, direction, 0f)); }
/// <summary> /// Make the remoting pipeline on the node throttle data sent to or received /// from the given remote peer. Throttling works by delaying packet submission /// within the netty pipeline until the packet would have been completely sent /// according to the given rate, the previous packet completion and the current /// packet length. In case of large packets they are split up if the calculated /// end pause would exceed `akka.testconductor.packet-split-threshold` /// (roughly). All of this uses the system’s scheduler, which is not /// terribly precise and will execute tasks later than they are schedule (even /// on average), but that is countered by using the actual execution time for /// determining how much to send, leading to the correct output rate, but with /// increased latency. /// /// ====Note==== /// To use this feature you must activate the failure injector and throttler /// transport adapters by specifying `testTransport(on = true)` in your MultiNodeConfig. /// </summary> /// <param name="node">is the symbolic name of the node which is to be affected</param> /// <param name="target">is the symbolic name of the other node to which connectivity shall be throttled</param> /// <param name="direction">can be either `Direction.Send`, `Direction.Receive` or `Direction.Both`</param> /// <param name="rateMBit">is the maximum data rate in MBit</param> /// <returns></returns> public Task <Done> Throttle(RoleName node, RoleName target, ThrottleTransportAdapter.Direction direction, float rateMBit) { RequireTestConductorTransport(); return(Controller.Ask <Done>(new Throttle(node, target, direction, rateMBit))); }
public ThrottleMsg(Address target, ThrottleTransportAdapter.Direction direction, float rateMBit) { _target = target; _direction = direction; _rateMBit = rateMBit; }
public SetThrottle(Address address, ThrottleTransportAdapter.Direction direction, ThrottleMode mode) { _address = address; _direction = direction; _mode = mode; }