Skip to content

Commit

Permalink
Disable bfetch in serverless (#183096)
Browse files Browse the repository at this point in the history
## Summary

Part of #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
  • Loading branch information
lukasolson authored May 30, 2024
1 parent 4c5afdf commit 37215fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions config/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 37215fb

Please sign in to comment.