Hi Pranav,
I do appreciate your attempts to suggestions to help me. We cannot use something like Selenium as we are not testing the CRM portal/web site. Our initial tests were using Visual Studio Web/Load tests, but ran into the performance issues described above. Our approach was to eliminate as many variables as possible to identify why our requests appear to be throttled. Our .NET client code is shown below for reference. As you can see the query is very basic. Our CRM instance is fairly empty right now and the Contact set has 36 rows.
When testing this code from a console app, when we have 1-10 instances, the queries/second increase linearly with each client. Once you hit 11+ clients, each request takes slightly longer time and the response time increases linearly with each new client. (ie the request rate stays the same).
It is clear that the CRM servers is the bottleneck and appears to limit how many concurrent queries can be run. From what I have read, I would guess it is related to the thread pool. In a standard .NET app, I would adjust the thread pool parameters either in the machine.config or through the TheadPool class in code. However, this is Microsoft CRM and any changes are typically require approval from Microsoft before we can make changes (that comes from our CRM team).
I fear this question is too specific and I should just submit a support ticket to Microsoft.
More information on the size of our CRM servers:
CRM front end/back end servers (2 each): Azure VMs: A4 v2 (4 cores, 8 GB RAM, 40 GB disk)
CRM database servers: Azure VMs: D3 v2 (4 cores, 14 GB RAM, 200 GB disk)
Uri uri = ...
ClientCredentials credentials = ...
IOrganizationService organizationService = new OrganizationServiceProxy(uri, null, credentials, null);
bool done = false; // done will be set to true externally by a timer
while (!done) {
FilterExpression filter = new FilterExpression();
filter.Conditions.Add(new ConditionExpression("contactid", ConditionOperator.Equal, Guid.NewGuid()));
QueryExpression query = new QueryExpression("contact");
query.ColumnSet.AddColumns("firstname", "lastname", "emailaddress1");
query.Criteria.AddFilter(filter);
// time and record how long this takes
EntityCollection entities = service.RetrieveMultiple(query);
// end of time
}