Perform Stress Test in C #


I have the following scenario: There is a Windows Service , done in C #, which is used to synchronize data from a local base with a cloud base and need to perform some stress tests and load, with this, I thought to perform the following test:

  • How would this service behave with network instabilities? For example, the internet crashed in the middle of the process and is therefore unable to sync.
  • Simulate a slow server that causes the process to take longer to execute.
  • Simulate a large data load.
  • I would like to know how I can simulate these test cases, especially case 1, since this is something that the system needs to deal with, as it is an already predicted scenario that normally occurs in the Windows Service environment.

    I've read that normally in the case of Windows Service, it's best to export the dll from it to test its public methods in this scenario, but I do not know to what extent this is true. / p>     

    asked by anonymous 22.06.2017 / 19:25

    2 answers


    What I believe can help with this:

  • I do not know how your architecture was modeled, but the use of some Jobs library might solve it. Take a look at Hangfire, which has automatic schedule in exceptions. This way if a network exception or something else is triggered, you do not have to worry about rescheduling the call.

  • Unfortunately, there is no simple way to do this. I believe you should have an idea of the type of server your service will run on, so maybe a Hyper-V machine where you create server simulations with more / less resources is the way. Processing slowness not only occurs through execution, but processing on the server, available memory. You have this reference on MSDN that can give you a path: link

  • If your architecture is totally disconnected, the correct thing would be to separate the service logic itself, and to perform unit-tests or load-tests on that layer. There are "n" libraries for unit test, including Visual Studio has a load-tests tool.

  • 28.06.2017 / 13:44

    Well, answering the list:

  • The system must be atomic, that is, it must be transacted to maintain the integrity of the data.

  • To simulate, simply change the hosts of the machine to an invalid ip and set a timeout in the transaction (mentioned in item 1)

  • I do not know exactly how the system and its architecture is, depending on what that data load can be obtained using Jmeter as a client.

  • 22.06.2017 / 19:49