php-crm-toolkit icon indicating copy to clipboard operation
php-crm-toolkit copied to clipboard

Performance of creating a contact

Open Benema3000 opened this issue 2 years ago • 3 comments

Hello Everyone!

First: Thanks to everyone involved in creating AlexaCRM! Awesome work.

I have a question/issue regarding the performance. I created a really simple example based on your tutorial, where I create a client and then create a contact. The client is created immediately, but it takes around 1 minute to create the contact.

I simply run: $contact = new \AlexaCRM\Xrm\Entity( 'contact' ); $contact['firstname'] = 'testX'; $contact['lastname'] = 'testX'; $contact['emailaddress1'] = '[email protected]'; $contactId = $client->Create( $contact );

and the $client->Create call takes 62 seconds. Is this normal? Do I have to do something differently?

Best and thanks! Ben

Edit: just tried to retrieve a contact, same there. It takes super long.

Benema3000 avatar May 23 '22 13:05 Benema3000

Hey Ben,

one-off hits are not unheard off due to metadata retrieval but 1 minute is quite a lot.

is that on prem or online? If online, I would strongly recommend switching to https://github.com/AlexaCRM/dynamics-webapi-toolkit that uses Web API. (Technically you can use it on-premises as well but I don't believe authentication is implemented yet for this scenario).

  • What about consequent operations, e.g. a create followed by a retrieve?
  • Where is the web server and where's CRM server?
  • Attach the logging to the client - that should give you more details about operation timing, specifically if it's the actual request is taking that long.

HTH George

georged avatar May 24 '22 06:05 georged

It's online, I will try the Web Api then. Thanks!

Should I still test the logging? If so how to do it?

Benema3000 avatar May 24 '22 10:05 Benema3000

I'd say the most probable cause of the poor performance is the latency between your server and Dataverse.

See https://github.com/AlexaCRM/dynamics-webapi-toolkit/wiki/Tutorial regarding the client set up for Web API. Any PSR-3 compliant logger can be wired in. You can also provide cache implementation for better performance.

georged avatar May 24 '22 11:05 georged