0

Crm Product entity contains 40,000 records.

In CustomerPortal, I am simply fetching all products and bind them to Grid.

For fetching query and binding code is like:

var DataSource = from products in xrm.ProductSet
                             select new DTO_RequiredProductField()
                             {
                                 Id = products.Id.ToString(),
                                 Name = products.Name.ToString(),
                                 Price = products.Price.ToString()
                             };
gdvProduct.DataSource = DataSource;
gdvProduct.DataBind();

This working fine, but only on first load it take upto 30 to 40 sec to load (after that the same page loads in just 2sec).

I didn't use session/cache and anything like that.

If i use the below query (taking only 5 records) then also the same delay behaviour:

var DataSource = from products in xrm.ProductSet.Take(5)
                             select new DTO_RequiredProductField()
                             {
                                 Id = products.Id.ToString(),
                                 Name = products.Name.ToString(),
                                 Price = products.Price.ToString()
                             };

Why delay of 30 to 40sec on first load?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

the first request to CRM is often slower than the next ones.

My suggestion is to do a WhoAmIRequest after you create the IOrganizationService object, so your product request will not be executed as first request.

Guido Preite
  • 14,905
  • 4
  • 36
  • 65