From 37215fbb006ce9c5f29c2576e952777f8e565876 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Fri, 31 May 2024 01:19:12 +0200 Subject: [PATCH] Disable bfetch in serverless (#183096) ## Summary Part of https://github.com/elastic/kibana/issues/181938. Disables bfetch in serverless by overriding the `bfetch:disable` advanced setting in the serverless.yml. Bfetch was introduced to bypass the browser connection limit when multiple search requests are made. Here's a picture of what the network tab looks like with bfetch turned off in http1: ![image](https://github.com/elastic/kibana/assets/1178348/40e156d1-1dc8-4a03-9d1d-cc6c1d61134e) As the number of requests reaches the connection limit (6 on most modern browsers), requests stall until a connection is available. In Cloud/serverless, we have a http2 proxy. Http2 does not have this browser connection limit. Turning off bfetch allows us to collect metrics to decide if we want to remove it altogether: | Bfetch enabled | Bfetch disabled (this PR) | | --------------- | ------------------------- | | ![image](https://github.com/elastic/kibana/assets/1178348/09c0673a-573f-422a-b95d-4fa1adcc08b5) | ![image](https://github.com/elastic/kibana/assets/1178348/0a44f8a4-d047-4b93-afc4-3fdb8a83b494) | In my tests, the overall time for a sample dashboard to load was actually smaller with bfetch disabled on http2 vs. bfetch enabled. ### Checklist - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- config/serverless.yml | 1 + .../common/discover/group3/_request_counts.ts | 2 +- .../search_examples/search_example.ts | 26 ++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/config/serverless.yml b/config/serverless.yml index 654b2a0a3a55e..43ac498e0901d 100644 --- a/config/serverless.yml +++ b/config/serverless.yml @@ -141,6 +141,7 @@ uiSettings: overrides: # Disables ESQL in advanced settings (hides it from the UI) enableESQL: true + bfetch:disable: true # Disables `Defer loading panels below "the fold"` labs:dashboard:deferBelowFold: false diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts b/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts index 78ab4b43c4ba2..ff0f2eadf3e20 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/group3/_request_counts.ts @@ -36,7 +36,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', - 'bfetch:disable': true, + // 'bfetch:disable': true, // bfetch is already disabled in serverless // TODO: Removed ES|QL setting since ES|QL isn't supported in Serverless }); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); diff --git a/x-pack/test_serverless/functional/test_suites/common/examples/search_examples/search_example.ts b/x-pack/test_serverless/functional/test_suites/common/examples/search_examples/search_example.ts index f2cbf39d96e5f..cea7d66c21daf 100644 --- a/x-pack/test_serverless/functional/test_suites/common/examples/search_examples/search_example.ts +++ b/x-pack/test_serverless/functional/test_suites/common/examples/search_examples/search_example.ts @@ -20,20 +20,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.svlCommonPage.loginAsAdmin(); }); - describe('with bfetch', () => { - testSearchExample(); - }); + // bfetch is disabled in serverless + // describe('with bfetch', () => { + // testSearchExample(); + // }); describe('no bfetch', () => { - const kibanaServer = getService('kibanaServer'); - before(async () => { - await kibanaServer.uiSettings.replace({ - 'bfetch:disable': true, - }); - }); - after(async () => { - await kibanaServer.uiSettings.unset('bfetch:disable'); - }); + // No need to disable since it is disabled in serverless.yml + // const kibanaServer = getService('kibanaServer'); + // before(async () => { + // await kibanaServer.uiSettings.replace({ + // 'bfetch:disable': true, + // }); + // }); + // after(async () => { + // await kibanaServer.uiSettings.unset('bfetch:disable'); + // }); testSearchExample(); });