Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

성능제약이 잘 작동하는지도 검증할수 있습니다.


이벤트가를 이벤트는 N개 동시 발생하며,  소비가 되는구간에서 성능카운트를 1올려줍니다.발생시킬수 있지만, TPS제약이 적용되어 최종 수신처리가 가되는 ThrottleLimitActor 가 준비되었으며

Code Block
themeEmacs
[Theory(DisplayName = "테스트 n초당 1회 호출제약")]
[InlineData(5, 1, false)]
public void ThrottleLimitTest(int givenTestCount, int givenLimitSeconds, bool isPerformTest)
{
.......
  // Create ThrottleLimit Actor
  throttleLimitActor = actorSystem.ActorOf(Props.Create(() => new ThrottleLimitActor(1, givenLimitSeconds, 1000)));
  throttleLimitActor.Tell(new SetTarget(probe))
  
  for (int i = 0; i < givenTestCount; i++)
  {
      throttleLimitActor.Tell(new EventCmd()
      {
          Message = "test",
      });
  }
  
  //Then : Safe processing within N seconds limit
  for (int i = 0; i < givenTestCount; i++)
  {
      probe.ExpectMsg<EventCmd>(message =>
      {
          Assert.Equal("test", message.Message);                        
      });
  
      output.WriteLine($"[{DateTime.Now}] - GTPRequestCmd");
  
      if (isPerformTest)
      {
          _dictionary.Add(_key++, _key);
          _addCounter.Increment();
      }
  }
...........
}  

...