Podcast
Questions and Answers
What should developers consider when adding libraries to their projects?
What should developers consider when adding libraries to their projects?
What is the primary advantage of using caching?
What is the primary advantage of using caching?
What does eTag caching help to determine?
What does eTag caching help to determine?
What should developers be cautious about with the Cache Manager in Configured Commerce?
What should developers be cautious about with the Cache Manager in Configured Commerce?
Signup and view all the answers
What is a significant use case for distributed caching in Configured Commerce?
What is a significant use case for distributed caching in Configured Commerce?
Signup and view all the answers
What should be done regarding cache settings during testing?
What should be done regarding cache settings during testing?
Signup and view all the answers
What often causes performance issues related to database access?
What often causes performance issues related to database access?
Signup and view all the answers
What is a best practice when setting cache refresh intervals?
What is a best practice when setting cache refresh intervals?
Signup and view all the answers
What is one major source of front end performance issues?
What is one major source of front end performance issues?
Signup and view all the answers
How can API performance problems manifest?
How can API performance problems manifest?
Signup and view all the answers
Which category does 3rd Party Interactions usually fall under?
Which category does 3rd Party Interactions usually fall under?
Signup and view all the answers
What is the first step in the general approach to improving performance?
What is the first step in the general approach to improving performance?
Signup and view all the answers
Why is it beneficial to plan for performance issues early?
Why is it beneficial to plan for performance issues early?
Signup and view all the answers
What should be avoided when utilizing promotions for pricing issues?
What should be avoided when utilizing promotions for pricing issues?
Signup and view all the answers
What is a potential drawback of using external providers for real-time data?
What is a potential drawback of using external providers for real-time data?
Signup and view all the answers
What is a common method for identifying performance problems?
What is a common method for identifying performance problems?
Signup and view all the answers
What is a potential consequence of having more than 40 variants on a product?
What is a potential consequence of having more than 40 variants on a product?
Signup and view all the answers
Why are custom properties useful in data modeling?
Why are custom properties useful in data modeling?
Signup and view all the answers
What is the recommended maximum depth for a category structure?
What is the recommended maximum depth for a category structure?
Signup and view all the answers
What can excessive use of attribute types or values lead to?
What can excessive use of attribute types or values lead to?
Signup and view all the answers
Why might it be beneficial to limit the number of customer segments?
Why might it be beneficial to limit the number of customer segments?
Signup and view all the answers
What is one suggested method to retrieve only necessary custom properties for a product?
What is one suggested method to retrieve only necessary custom properties for a product?
Signup and view all the answers
What should be considered when designing systems to retrieve products?
What should be considered when designing systems to retrieve products?
Signup and view all the answers
What impact can the number of traits on variant products have?
What impact can the number of traits on variant products have?
Signup and view all the answers
What is the primary reason for limiting the number of active promotions in a system?
What is the primary reason for limiting the number of active promotions in a system?
Signup and view all the answers
How should languages be managed in the system to optimize performance?
How should languages be managed in the system to optimize performance?
Signup and view all the answers
What method is recommended for handling inventory updates when the ERP requires separate API calls per product?
What method is recommended for handling inventory updates when the ERP requires separate API calls per product?
Signup and view all the answers
Why might running a large number of concurrent promotions slow down the checkout process?
Why might running a large number of concurrent promotions slow down the checkout process?
Signup and view all the answers
What is a potential drawback of using the 'Generate Records' option in the Admin Console for translations?
What is a potential drawback of using the 'Generate Records' option in the Admin Console for translations?
Signup and view all the answers
What is a common practice regarding API calls for pricing when integrating with the ERP?
What is a common practice regarding API calls for pricing when integrating with the ERP?
Signup and view all the answers
What is an expensive operation when calculating tax in a cart scenario?
What is an expensive operation when calculating tax in a cart scenario?
Signup and view all the answers
What is a performance consideration when managing shipping calculations in the system?
What is a performance consideration when managing shipping calculations in the system?
Signup and view all the answers
What is the primary reason for including SQL-convertible filters before enumerating a LINQ query?
What is the primary reason for including SQL-convertible filters before enumerating a LINQ query?
Signup and view all the answers
Which method is recommended to check if a collection has any elements more efficiently?
Which method is recommended to check if a collection has any elements more efficiently?
Signup and view all the answers
What is the advantage of using projections in a LINQ query?
What is the advantage of using projections in a LINQ query?
Signup and view all the answers
What should be avoided when executing queries in loops to maintain performance?
What should be avoided when executing queries in loops to maintain performance?
Signup and view all the answers
What is the effect of using GetTableAsNoTracking() when retrieving data in Entity Framework?
What is the effect of using GetTableAsNoTracking() when retrieving data in Entity Framework?
Signup and view all the answers
When might stored procedures be preferred over Entity Framework for performance?
When might stored procedures be preferred over Entity Framework for performance?
Signup and view all the answers
What consequence does Entity Framework tracking have on performance?
What consequence does Entity Framework tracking have on performance?
Signup and view all the answers
What feature does the Storefront APIs offer to optimize result sets?
What feature does the Storefront APIs offer to optimize result sets?
Signup and view all the answers
Study Notes
Performance Bottlenecks
-
Front end performance can be negatively affected by:
- Bad Javascript code
- Excessive libraries
- Large images
- These issues impact every user, but are more severe on slow connections (like mobile devices).
-
API performance problems can arise from:
- API code errors
- Inefficient loops (repetitive code execution)
- Database issues
- These issues may affect individual users or worsen with increased website traffic.
-
3rd Party Interactions can be problematic due to external service integration, such as real-time ERP calls for pricing.
- They are challenging to manage as they are often outside the control of the platform or developer.
- Strategies exist to mitigate these challenges.
General Approach for Performance Optimization
-
Planning: Proactive performance considerations are crucial.
- Analyze potential performance impacts during customization or implementation planning.
- Choose the most efficient solution, considering alternatives like promotions versus pricing pipeline adjustments.
-
Detection: Identifying performance issues is essential.
- Various tools and methods can help pinpoint problem areas.
- Focus on adding libraries intentionally and avoid large libraries for single functions.
Optimizing Performance with Caching
- Caching is a critical tool for performance enhancement.
- Configured Commerce relies heavily on caching throughout the system, but it requires manual configuration and strategic implementation for custom code.
-
eTag Caching:
- Determines the state of an API request, returning a "Not Modified" status (304) if data hasn't changed.
- Prevents redundant server calculations and data transfer, improving performance.
-
Cache Manager:
- Allows developers to cache frequently unchanging data within Configured Commerce.
- Requires careful management of cache size to prevent automatic eviction.
- Developers need to balance cache lifetime with the cost of reloading data.
-
Shared (Distributed) Cache:
- Configured Commerce supports Redis or SQL Server for distributed caching, primarily used for real-time inventory and pricing calls.
- Data is first loaded from the local server, and if unavailable, it's retrieved from the shared cache and cached locally.
- This layered approach significantly enhances overall performance.
-
Cache Settings:
- Enable cache settings (CMS Content, Category Menu) and set refresh intervals appropriately.
- Caching is often disabled or set to a low value during testing to facilitate quicker observation of changes.
Database Access Performance
- Database access is a common source of performance issues.
- Issues can arise from:
- Excessive database calls
- Retrieval of too much data
- Inefficient database queries
- The ideal approach involves a balance between performance and the site's needs.
- Don't prioritize retrieving a massive number of products simultaneously.
-
Variant Products:
- Design allows for 2-4 traits per product.
- Products with more than 10 traits can negatively impact display and interaction on product detail pages.
- Products with over 40 variants may present pricing and inventory challenges.
-
Custom Properties:
- Useful for extending data models but represented as name/value pairs in the database.
- When applied to Product entities, consider performance implications carefully compared to the convenience they offer.
- For most entities, retrieving a large number of custom properties (e.g., 50 for a customer) is unlikely to pose a problem.
- However, applying many custom properties to Product or Category tables can lead to performance concerns.
- Strategies include retrieving only necessary properties through the ProductCollection pipeline or using a custom table instead of custom properties.
-
Categories:
- Ideal category structure should be no more than three levels deep.
- Users often rely on search rather than category navigation.
- Filters like attribute filters offer a superior browsing experience compared to navigating numerous category levels.
-
Customer Segments:
- Leveraging segmentation effectively enhances merchandise presentation.
- Excessive segments can make system and content management challenging.
- Segment assignments are visible within page source.
-
Attribute Types/Values:
- An abundance of attributes can slow down search and faceted navigation, potentially leading to confusing results pages with a long list of attributes.
- Plan carefully which attributes to expose for faceting and comparison.
-
Calculating Tax/Shipping in Cart:
- Tax calculations often involve external API calls to tax services or ERPs, which are resource-intensive.
- The system is designed to avoid recalculating taxes on the checkout page, as cart visits are more frequent than checkout visits.
- Shipping calculations also involve accessing multiple transportation services, impacting performance.
- These operations can be delayed until necessary by system settings.
-
Promotions:
- Promotions are a powerful feature but can slow down performance, especially when numerous promotions are active.
- 10-15 concurrent promotions generally pose no significant problem, but 500+ promotions can lead to performance issues.
- The "Allow Multiple Promotions" setting only affects the order level and doesn't eliminate the need to check individual line-level promotions.
-
Languages:
- The number of languages is generally not a performance concern, except during Elasticsearch indexing.
- Separate indexes are created for each active language, so activating only necessary languages is recommended.
-
Real-Time Services:
- API calls to ERPs for pricing and inventory are common and beneficial if the ERP allows multiple product pricing and inventory retrieval with a single API call.
- However, if the ERP requires individual calls per product or inventory item, latency can significantly impact performance.
- In such cases, using a refresh job for inventory and relying on real-time calls for pricing is recommended.
-
Translations:
- Create transaction records only for translations to avoid generating numerous empty records that can slow down the system.
- If translations are not used, disable the "Enable Translation Properties" option for better performance.
Code-Specific Optimization Techniques
-
ToList:
- In LINQ queries, convert filters into SQL statements before enumeration to retrieve only needed data and avoid overloading the Entity Framework context.
- Filtering data after marshalling to the client is inefficient.
-
Projections:
- Use projections if not all fields are required.
- Instead of
First().Id
, useSelect(o => o.Id).First()
. - Extract specific columns using
Select(o => new { o.Id, o.CreateBy })
, reducing database load, network bandwidth, and Entity Framework processing time.
-
Any:
- Use
.Any()
instead of.Count() >= 1
, as.Any()
stops after the first match, while.Count
processes all candidates.
- Use
-
Only Return Required Data:
- Storefront APIs allow specifying desired fields in the result set using the query string
&select=field1,field2…
. - This reduces the payload size but doesn't lighten the query load on servers.
- Storefront APIs allow specifying desired fields in the result set using the query string
-
Repeating Queries:
- Avoid running repeating queries within loops.
- Each query requires a network round trip, leading to linear increase in runtime with more iterations.
- Fetch all needed data outside the loop for better performance.
-
Stored Procedures:
- Entity Framework generally performs well and provides ease of upgrading and simplified code.
- However, stored procedures outperform Entity Framework with the same queries, support multiple queries in a single network request, and efficiently process large input data lists using Table Valued Parameters.
- If Entity Framework tuning fails to achieve acceptable performance, stored procedures offer a potential solution.
-
Entity Framework Tracking:
- Entity Framework tracks object states to ensure changes are committed to the database.
- This feature provides convenience but adds overhead.
- For data that does not require modification, use
GetTableAsNoTracking()
when retrieving it.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Explore key performance bottlenecks in web development, focusing on front-end performance, API performance issues, and challenges involved with third-party interactions. This quiz will equip you with strategies to optimize performance effectively, ensuring a smoother user experience.