multithreading - Integration multi-threading test to stress test a server -
i'm new world of c# threads , want stress test particular server method. i'd somehow capture time taken run process , return in way. or, if server returns error message, ramp concurrent threads... is, sort of decay statistics users ramp up. i'm looking simple yet effective...
i'm going call process integration test this:
[test] public void stresstest_someexpensivemethod_approach() { int no_threads = 10; thread thread = null; myclass myc = new myclass(); (int = 0; < no_threads; i++) { thread = new thread(myc.doexpensivework); thread.name = i.tostring(); thread.priority = threadpriority.highest; thread.start(); } } i have class myclass below. class contains method doexpensivework(). i'm trying call doexpensivework() specified fixed number of threads (say 10 or 20 , ramp there) someexpensivemethod (an expensive process < 1 second though usually) , stores result in list
i've been told need use callbacks , locking mechanism i'm stuck. can me please? i'm using parameterised threading reckon have wrong.
i need little bit of coding here 1 please. appreciate if modify example below suggestions...
thanks sandra
public class myclass { public void doexpensivework() { serverclass cs = new serverclass(); string testdata = "sometestdata"; //*** call method-under-test ***// datetime starttime = datetime.now; ilist<string> response = cs.someexpensivemethod(testdata); datetime endtime = datetime.now; } }
if have vs 2010 ultimate or newer, can create load tests bunch of different parameters , reporting gives while running helpful. link below may in endeavor: http://visualstudiomagazine.com/articles/2010/07/08/load-testing-with-visual-studio-2010.aspx
Comments
Post a Comment