Skip to content

Search suggestions result in dozens of queued AJAX requests #71

@magento-engcom-team

Description

@magento-engcom-team

Preconditions

  1. Install Magento Open Source 2.2.2 with sample data

Steps to reproduce

  1. Load frontend with the Network panel open in Chrome's DevTools. Start typing quickly (even random characters is ok).

Expected result

  1. Magento should wait a small period of time (50ms?) before sending a search suggestion to the server

Actual result

  1. Every character that is typed results in a new AJAX request being sent to the server, which causes them to get backed up.
    13-01-06 screen shot 2018-03-27 at 1 00 47 pm-mwqn5
  2. A side effect of the server being slammed with requests: If Redis is being used for session management, some of the requests might return a 503 error like this:
    Warning: session_start(): Failed to read session data: user (path: /var/www/stage/releases/20180223190752/var/session/) in /var/www/stage/releases/20180223190752/vendor/magento/framework/Session/SessionManager.php on line 189
    
    This can be overcome by increasing the max_concurrency value in env.php, but this isn't the best solution to this problem.

Suggested Solution

Implement the underscore debounce function to delay the sending of the search suggestion until the user stops typing. However this may result in a degradation of the user experience as search suggestions might show more slowly so the wait variable passed to debounce should be tested to determine the best tradeoff between server load and user experience.

Original Report: magento/magento2#14402 by @erikhansen

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions