Sunday 20 March 2022

Salesforce Real Time Performance Issues -Optimization Solutions

Performance is one of the area we always fail to notice initially & Deprioritized. It only get the priority when it becomes the bottle neck.

1.Use Case : Service cloud project agent receives a transferred call and A custom component (LWC) should load in modal popup to perform the authentication of customer (Custom logic as per business requirements). It's taking 2 mins to load that modal pop up in one of the test environment & Its intermittent issue.

Root Cause :

  • Unindexed field is been used in the query filter & Record count is around 75K
Fix :
  • Delete unwanted records 
  • Have a schedule delete data job to run on regular basis 
  • Index the field - Marked as external id in our case which automatically creates index on it

After Fix Outcome : There is significant improvement of performance from 2 Min to <  2 Sec

Why intermittent ? 

1.Initally the query taking time and later it was fetching form cache that is the reason it was intermittent.

2.In parallel deployment activity to sand box / Any data load also would have been a reason.

Investigation Steps : 

  • Open the component and see the logic written in life cycle hooks 
  • This case flow :  From CTI --> Apex Class Method called with the required details passed --> Apex method Triggers Platform event  with the details --> LWC component is subscriber --> The received details  will passed to "Apex Class" to get the further details from objects
  • Divide the parts into 2 ,
    • One from CTI to LWC component how much time it is taking & 
    • Second when subscriber passes values to Apex how much time it is taking to written.
  • Drill down deeper into the area where issue exist & Use console logs & Debug logs to notice exact issue location