MVC_Nhibernate
MVC_Nhibernate

Reputation: 457

Dynamics CRM + Execute requests in parallel

I have a complex azure function which creates/updates approx 400 records in a table in dataverse while checking several conditions

I am using ExecuteTransactionRequest to create/update the records and it takes around 15 seconds to perform the logic. Is there a way I can make it faster, introduce parallel processing along with executetransation?

Upvotes: 1

Views: 530

Answers (1)

YazanGhafir
YazanGhafir

Reputation: 864

I'm not sure if my answer is applicable in your scenario, but I'll mention it for reference.

WebApi accepts a batch requests which saves you the latency time of sequential and concurrent requests. One request with multiple internal requests is sent once to the api and will run on their servers at once and get back the results.

That is if you are using WebApi and not using connectors to communicate with CDS.

If so, please refer to the following example to post 2 currencies and get all:

--batch_ABC123
Content-Type: multipart/mixed; boundary=changeset_ABC111

--changeset_ABC111
Content-Type: application/http
Content-Transfer-Encoding: binary

POST YOUR-RESOURCE_URL/api/data/v9.1/transactioncurrencies HTTP/1.1
Content-ID: 1
Accept: application/json;
Content-Type: application/json;type=entry

{"currencyname": "Dansk Krona1","currencysymbol": "$","isocurrencycode": "PPV","exchangerate": 0.90}

--changeset_ABC111
Content-Type: application/http
Content-Transfer-Encoding: binary

POST YOUR-RESOURCE_URL/api/data/v9.1/transactioncurrencies HTTP/1.1
Content-ID: 2
Accept: application/json;
Content-Type: application/json;type=entry

{"currencyname": "Dansk Krona2","currencysymbol": "$","isocurrencycode": "UPV","exchangerate": 0.90}
--changeset_ABC111--

--batch_ABC123
Content-Type: application/http
Content-Transfer-Encoding:binary

GET YOUR-RESOURCE_URL/api/data/v9.1/transactioncurrencies HTTP/1.1
Accept: application/json

--batch_ABC123--

Upvotes: 1

Related Questions