How can I approach to slow performance of the apex site?

165    Asked by Deepabhawana in Salesforce , Asked on Apr 4, 2024

 I am an apex site administrator for a particular company that relies on Salesforce for the management of customer data and workflow. One of my sales team is experiencing slow performance when they are trying to access certain reports and dashboards. How can I approach this particular scenario? 

Answered by Deepak Mistry

 In the context of salesforce, there should be the approach for you:-

Identify the performance bottleneck

You can use the built-in monitoring system or tools such as the lightning usage application of Salesforce to identify the reports or dashboards that are causing slow performance.

Optimization of SOQL queries

You can check the underlying SOQL queries that are used in the slow performance of reports or dashboards. You can optimize them by reducing the number of fields queried.

Implement caching

You can also consider caching frequently accessed data by using the platform cache. This would help in reducing the need for repetitive queries and would improve overall performance.

Review dashboard Component

You can evaluate the components that are used in the slow dashboard. You should minimize the use of complex or resource-intensive Components.

Here is the combined coding snippet given which would optimize a SOQL query and implement caching in apex:-

// Create a set to hold industry values for selective filtering
Set industries = new Set{‘Technology’, ‘Healthcare’, ‘Finance’};
// Check if data is already cached
String cacheKey = ‘AccountData’;
List cachedAccounts = (List)Cache.Org.get(cacheKey);
If (cachedAccounts == null) {
    // Data not found in cache, perform the SOQL query
    List accounts = [SELECT Id, Name, Industry FROM Account WHERE Industry IN : industries LIMIT 1000];
    // Cache the queried data for 1 hour
    Cache.Org.put(cacheKey, accounts, 3600);
} else {
    // Use cached data
    List accounts = cachedAccounts;
}
// Now use the ‘accounts’ list for further processing


Your Answer

Interviews

Parent Categories