Slow response time on Swiftype search

Hi,

We are experiencing very slow response times from Swiftype. From our express app, we are using a very simple search query to Swiftype, and we get response times of 600-6000ms. This feels very unstable and slow. Do you have any ideas on what can be causing this? We are using the standard plan, but our guess is that the standard plan is not expected to be this unstable? We currently only have 260 crawled documents btw.

Here is the only thing we’re doing when requesting Swiftype:

    try {
      const { queryString, locale } = req.query
      const client = new SiteSearchClient({
        apiKey: process.env.SITE_SEARCH_API_KEY,
      })
      client.search(
        {
           engine: process.env.SITE_SEARCH_ENGINE_SLUG,
           q: queryString,
           filters: {
              page: {
                 locale: locale,
              },
           },
        },
    (error, response) => {
      if (response) {
      res.send(response)
    }
    if (error) {
      console.error(error)
      returnErrorContentApi('Bad response.', prefix)
    }
    next()
    }
    )
    } catch (error) {
    console.error(error)
    returnErrorContentApi('Bad response.', prefix)
    }

Thanks in advance!

Hi Petas,

Just to check, what general continent/region are you making requests from? Traffic from Europe requests are expected to take ~400ms longer than from the mainland US (speed of light + HTTPS handshake protocol specifics).

There is a way to lean on our API POP nodes around the world to help with the issue though. You can replace api.swiftype.com in your request with search-api.swiftype.com and your traffic will be routed through a network of our POP nodes which should cut SSL handshake and TCP connection time significantly.

It looks like you're using the Site Search Node client - you should be able to override the host used to search-api.swiftype.com by setting config.host.

Another alternative option for gaining some speed might be to try using suggest.json/client.suggest instead of search.json, as users have previously reported gaining 100ms or so with smaller searches.

Hope that helps,
Constance

Hi Constance,

Thank you for the helpful answer! Using the API POP-approach our response time dropped to around 250-300ms fairly consistently, which of course is much better!

Once more, thank you for the great answer.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.