Monitor Performance	Frontend performance
40 Questions
1 Views

Monitor Performance Frontend performance

Created by
@SupportedAstatine4145

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What should developers consider when adding libraries to their projects?

  • Using large libraries for minor functions enhances performance.
  • Isolating components instead of downloading entire libraries is advisable. (correct)
  • Adding only well-known libraries is sufficient.
  • All libraries should be included to have robust functionality.
  • What is the primary advantage of using caching?

  • It can significantly improve performance if used correctly. (correct)
  • It protects against server overload without configuration.
  • It guarantees data consistency.
  • It reduces the need for data loading completely.
  • What does eTag caching help to determine?

  • The condition of an API request on the server. (correct)
  • The optimal cache refresh rate.
  • The amount of data that can be cached.
  • The speed of database queries.
  • What should developers be cautious about with the Cache Manager in Configured Commerce?

    <p>Storing too much data, risking automatic cache eviction.</p> Signup and view all the answers

    What is a significant use case for distributed caching in Configured Commerce?

    <p>For real-time inventory and pricing calls.</p> Signup and view all the answers

    What should be done regarding cache settings during testing?

    <p>Disable caching completely to see immediate changes.</p> Signup and view all the answers

    What often causes performance issues related to database access?

    <p>Performing too many queries or retrieving excessive data.</p> Signup and view all the answers

    What is a best practice when setting cache refresh intervals?

    <p>Set intervals to the highest reasonable value without causing delays.</p> Signup and view all the answers

    What is one major source of front end performance issues?

    <p>Poor Javascript code</p> Signup and view all the answers

    How can API performance problems manifest?

    <p>Due to coding issues and looping</p> Signup and view all the answers

    Which category does 3rd Party Interactions usually fall under?

    <p>External provider-related problems</p> Signup and view all the answers

    What is the first step in the general approach to improving performance?

    <p>Planning for performance</p> Signup and view all the answers

    Why is it beneficial to plan for performance issues early?

    <p>To effectively manage future bottlenecks</p> Signup and view all the answers

    What should be avoided when utilizing promotions for pricing issues?

    <p>Implementing too many unique promotions</p> Signup and view all the answers

    What is a potential drawback of using external providers for real-time data?

    <p>Control issues due to external dependencies</p> Signup and view all the answers

    What is a common method for identifying performance problems?

    <p>Generic tools and approaches</p> Signup and view all the answers

    What is a potential consequence of having more than 40 variants on a product?

    <p>Issues in pricing and inventory</p> Signup and view all the answers

    Why are custom properties useful in data modeling?

    <p>They allow for a compact representation of data as name/value pairs</p> Signup and view all the answers

    What is the recommended maximum depth for a category structure?

    <p>3 levels</p> Signup and view all the answers

    What can excessive use of attribute types or values lead to?

    <p>Longer search and faceting times</p> Signup and view all the answers

    Why might it be beneficial to limit the number of customer segments?

    <p>To avoid management complexities</p> Signup and view all the answers

    What is one suggested method to retrieve only necessary custom properties for a product?

    <p>Alter the ProductCollection pipeline</p> Signup and view all the answers

    What should be considered when designing systems to retrieve products?

    <p>Meeting the overall needs of the site</p> Signup and view all the answers

    What impact can the number of traits on variant products have?

    <p>It can affect display and interaction on the product page</p> Signup and view all the answers

    What is the primary reason for limiting the number of active promotions in a system?

    <p>Too many promotions lead to slower calculations.</p> Signup and view all the answers

    How should languages be managed in the system to optimize performance?

    <p>Only activate languages that are currently required.</p> Signup and view all the answers

    What method is recommended for handling inventory updates when the ERP requires separate API calls per product?

    <p>Only rely on real-time calls for pricing.</p> Signup and view all the answers

    Why might running a large number of concurrent promotions slow down the checkout process?

    <p>The system needs to check all line level promotions.</p> Signup and view all the answers

    What is a potential drawback of using the 'Generate Records' option in the Admin Console for translations?

    <p>It can create many empty records that slow down the system.</p> Signup and view all the answers

    What is a common practice regarding API calls for pricing when integrating with the ERP?

    <p>Combine multiple product requests into a single call whenever possible.</p> Signup and view all the answers

    What is an expensive operation when calculating tax in a cart scenario?

    <p>Conducting an API call to an external tax service.</p> Signup and view all the answers

    What is a performance consideration when managing shipping calculations in the system?

    <p>Minimize real-time calls until the calculation is needed.</p> Signup and view all the answers

    What is the primary reason for including SQL-convertible filters before enumerating a LINQ query?

    <p>To reduce the amount of data processed by Entity Framework.</p> Signup and view all the answers

    Which method is recommended to check if a collection has any elements more efficiently?

    <p>.Any()</p> Signup and view all the answers

    What is the advantage of using projections in a LINQ query?

    <p>They reduce the number of fields returned, limiting memory usage.</p> Signup and view all the answers

    What should be avoided when executing queries in loops to maintain performance?

    <p>Calling multiple LINQ queries within the loop.</p> Signup and view all the answers

    What is the effect of using GetTableAsNoTracking() when retrieving data in Entity Framework?

    <p>It prevents the tracking of retrieved objects to reduce overhead.</p> Signup and view all the answers

    When might stored procedures be preferred over Entity Framework for performance?

    <p>When you need to run multiple queries in a single network request.</p> Signup and view all the answers

    What consequence does Entity Framework tracking have on performance?

    <p>It adds additional overhead for tracking object states.</p> Signup and view all the answers

    What feature does the Storefront APIs offer to optimize result sets?

    <p>The ability to specify which fields to return in the result set.</p> 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, use Select(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.
    • 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.
    • 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.

    Quiz Team

    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.

    More Like This

    Use Quizgecko on...
    Browser
    Browser