I require a C# .NET 4.0 console application that can be set to repeatedly make requests to an API that I host and periodically store the results in an MSSQL 2005 table.
Anything in single quotes = an AppSettings key. The entire list of settings that this application will take is:
- ‘ThreadCount’: the number of threads to run
- ‘ThrottleMs’: the time each thread should wait between requests.
- ‘ApiDomain’: the domain of the API being tested.
- ‘RunForever’: when true, application will loop and never stop making requests
- ‘DbWriteInterval’: determines how frequently to dump results to DB
*HOW FAST? AND HOW WIDE?*
The console app will run ‘ThreadCount’ number of threads that will then each make a request every ‘ThrottleMs’ or as fast as is possible. For example, if ‘ThrottleMs’ = 500 but a request takes 1500ms to come back, just make a new request after the 1500ms. If a request comes back in 100ms, then sleep that thread for 400ms before requesting again.
*WHAT REQUESTS SHOULD BE MADE?*
An MSSQL table name Input_UrlApi will hold the path and query string portion of all the requests that we want made. The domain will be a setting under ‘ApiDomain’. Read the entire table into memory before beginning any requests for best performance.
It is up to you how you store the urls and how you allocate them to each thread. You could either have a single data structure that all threads hit or divy things up so each thread has a list of URLs that it owns. I have no preference.
Once all requests are made, then the application will look at a bool kept in ‘RunForever’. If true, start over from the top. Otherwise, exit.
*WHAT SHOULD BE STORED?*
First and foremost, DO NOT write the request results to the DB every single request. There will instead be a single DataTable that all threads write to until ‘DbWriteInterval’ is reached. At this point the DataTable will be bulk inserted into the database table named Results_Raw. Use System.Data.SqlClient.SqlBulkCopy. If all threads have to wait for the bulk insert and there is a pause in execution that is ok.
The central DataTable will have the following columns:
- Timestamp - the datetime when the request was first started
- Request_Time_Ms - the time that the request too to complete in milliseconds
- Url - the entire url requested
- Http_Status - the status code returned by the API. Ex: “200” for a successful request
- Bytes_Returned - the number of bytes in the response. You need to read the entire response into a byte for this purpose alone.
- Thread_Count - the number of threads currently running for this test
Each request must be signed with an HMAC style signature. I have provided a C# .NET 4.0 console application that makes an authenticated request to the API that I am hosting. Check out the app and get your requests to authenticate based on what you find there. Be sure to test my app first and make sure that it can authenticate ok from your dev environment before you get too far.
I try not to get hung up on every detail when writing a spec. I’d rather rely on your best judgement.
That being the case, once I get your work back I will almost certainly ask for something to be changed or added outside of my original spec. So plan on ~10-15% scope creep as I start to use and try out the code. Anything beyond that and he can add additional milestones or whatever works to make sure you are fairly compensated.
6 freelancer bu iş için ortalamada 406$ teklif veriyor
Dear Sir I went through the long/detailed description and understood the requirement. Pleas have a look in your message box. thanks and regards the grtcoder