Simulate multiple client connections to a server
I want to test my server as to how many simultaneous connections it can handle .. having considerably low connection problems... in other words to simulate a stress testing S开发者_StackOverflowcenario. How do I go about it? Thanks for your advice.
You could create a class called SimulatedClient
, which encapsulates a Thread
. The Thread could just connect to your server, or send a HTTP GET request simulating downloading a file, or anything else you'd like. You could create any sort of application to host the clients, say a Console or WPF app.
It would create any number of SimulatedClients
(perhaps configurable in app.config), start them all then monitor for problems (by catching and logging exceptions - or simply breaking into the debugger) and/or perform any performance testing. If it's the latter I would suggest taking a look at the System.Diagnostics.Stopwatch
class.
With a WPF or other kind of visual app you could have a nice grid (e.g. ListView with the View set to a GridView) bound to the collection of simulated clients, with columns for things like Status, Duration, Errors - if you made them DependencyProperties you would see the results update in realtime.
If it's a web server see http://support.microsoft.com/kb/231282
精彩评论