Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core.uiSettings] Adds cache for raw settings to boost performance of getAll() #97070

Closed
wants to merge 3 commits into from

Conversation

lukeelmers
Copy link
Member

@lukeelmers lukeelmers commented Apr 14, 2021

Closes #97025
As explained in #75850, the upgrade to lodash 4 resulted in some performance degradations in the defaultsDeep method.

A few users have noticed some performance issues in Kibana after upgrading to 7.12, and after doing some profiling, @wylieconlon noticed that we could improve the way we use defaultsDeep in the ui settings client.

This PR makes 2 changes:

  1. Changes places we call defaultsDeep to pass 2 arguments instead of 3, which provides a slight perf boost
  2. Updates the ui settings client to cache the results of defaultsDeep, which can boost performance significantly in scenarios where frequent calls to getRaw() are being made. In Wylie's testing using a complex dashboard, the performance of getRaw() improved by an order of magnitude after a cache was added.

@lukeelmers lukeelmers added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc performance v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.13.0 v7.12.1 Feature:uiSettings labels Apr 14, 2021
@lukeelmers lukeelmers self-assigned this Apr 14, 2021
@lukeelmers lukeelmers requested a review from a team as a code owner April 14, 2021 03:57
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@mshustov
Copy link
Contributor

mshustov commented Apr 14, 2021

Changes places we call defaultsDeep to pass 2 arguments instead of 3, which provides a slight perf boost

I removed this change. {...obj } creates a shallow copy, as a result, defaultsDeep mutates the nested object. It caused https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/119495/execution/node/575/log/

@@ -143,8 +146,17 @@ export class UiSettingsClient implements IUiSettingsClient {
}

private async getRaw(): Promise<UiSettingsRaw> {
const cachedValue = this.rawCache.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really happy with 2 levels of caching, but I'd defer to the full refactoring of the UI settings service to address the problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ Agreed on this, I think the perf benefits make this worth it as an interim solution, but really we should restructure this during a proper refactoring


await uiSettings.getAll();
expect(savedObjectsClient.get).toHaveBeenCalledTimes(1);
expect(lodashDefaultsDeep).toHaveBeenCalledTimes(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh we should test that result of getAll and arguments of defaultsDeep cannot be mutated, instead of testing the implementation detail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this change. {...obj } creates a shallow copy, as a result, defaultsDeep mutates the nested object

Thanks for catching (and fixing) this! Will update this test as well.

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't run the performance tests on this code, but I don't think this solves the core problem that with the use of lodash. See #75850 for more details, but the most important is that the three-argument version of mergeDeep is exponentially slower.

const userProvided = await this.getUserProvided();
return defaultsDeep({}, userProvided, this.defaults);
const result = defaultsDeep({}, userProvided, this.defaults);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern of using lodash with 3 arguments is exactly what we are trying to avoid. It really must be two arguments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What pattern do you suggest using when merging two objects into a third one without mutating any of the input objects then?

Copy link
Contributor

@mshustov mshustov Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the best alternative would be don't use defaultsDeep at all or remove getAll from the public contract on the server-side (we would reduce the number of js object processed on every get(..)).
Removing getAll aligns with our approach of removing implicit dependencies across the plugins. I'd go this way. It requires data plugin refactoring to provide API to register fieldFormatters

fieldFormatsRegistry.init((key: string) => uiConfigs[key], {}, this.fieldFormatClasses);
and remove their custom cache implementation
const uiSettingsCache = pick(await uiSettingsClient.getAll(), aggsRequiredUiSettings);

We can remove getAll from the client-side public contract as soon as Advanced Settings UI becomes part of Core.

@lukeelmers
Copy link
Member Author

Going to move this back into draft until we can work on a proper solution

@lukeelmers lukeelmers marked this pull request as draft April 20, 2021 14:11
@TinaHeiligers
Copy link
Contributor

@lukeelmers I added the item to the list of uiSettings enhancements.

@mshustov
Copy link
Contributor

@lukeelmers I actually found my old PR improving performance for this logic #85027
I can actualize it

@mshustov mshustov closed this Apr 25, 2021
@mshustov mshustov reopened this Apr 25, 2021
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / X-Pack API Integration Tests.x-pack/test/api_integration/apis/security_solution/feature_controls·ts.apis SecuritySolution Endpoints feature controls APIs can't be accessed by user with dashboard "all" privileges

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 8 times on tracked branches: https://github.com/elastic/kibana/issues/97355

[00:00:00]       │
[00:00:00]         └-: apis
[00:00:00]           └-> "before all" hook in "apis"
[00:06:11]           └-: SecuritySolution Endpoints
[00:06:11]             └-> "before all" hook in "SecuritySolution Endpoints"
[00:07:26]             └-: feature controls
[00:07:26]               └-> "before all" hook for "APIs can't be accessed by user with no privileges"
[00:07:26]               └-> APIs can't be accessed by user with no privileges
[00:07:26]                 └-> "before each" hook: global before each for "APIs can't be accessed by user with no privileges"
[00:07:26]                 │ debg creating role logstash_read
[00:07:26]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] added role [logstash_read]
[00:07:26]                 │ debg creating user logstash_read
[00:07:26]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] added user [logstash_read]
[00:07:26]                 │ debg created user logstash_read
[00:07:27]                 │ info [o.e.m.j.JvmGcMonitorService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] [gc][472] overhead, spent [457ms] collecting in the last [1s]
[00:07:27]                 │ proc [kibana]   log   [17:05:41.106] [warning][api-authorization][plugins][security] User not authorized for "/api/solutions/security/graphql": responding with 403
[00:07:27]                 │ debg deleting role logstash_read
[00:07:27]                 │ debg deleting user logstash_read
[00:07:27]                 │ debg deleted user logstash_read
[00:07:27]                 └- ✓ pass  (781ms) "apis SecuritySolution Endpoints feature controls APIs can't be accessed by user with no privileges"
[00:07:27]               └-> APIs can be accessed user with global "all" privileges
[00:07:27]                 └-> "before each" hook: global before each for "APIs can be accessed user with global "all" privileges"
[00:07:27]                 │ debg creating role global_all
[00:07:27]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] added role [global_all]
[00:07:27]                 │ debg creating user global_all
[00:07:27]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] added user [global_all]
[00:07:27]                 │ debg created user global_all
[00:07:27]                 │ debg deleting role global_all
[00:07:27]                 │ debg deleting user global_all
[00:07:27]                 │ debg deleted user global_all
[00:07:27]                 └- ✓ pass  (456ms) "apis SecuritySolution Endpoints feature controls APIs can be accessed user with global "all" privileges"
[00:07:27]               └-> APIs can't be accessed by user with dashboard "all" privileges
[00:07:27]                 └-> "before each" hook: global before each for "APIs can't be accessed by user with dashboard "all" privileges"
[00:07:27]                 │ debg creating role dashboard_all
[00:07:27]                 │ info [o.e.x.s.a.r.TransportPutRoleAction] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] added role [dashboard_all]
[00:07:27]                 │ debg creating user dashboard_all
[00:07:27]                 │ info [o.e.x.s.a.u.TransportPutUserAction] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] added user [dashboard_all]
[00:07:27]                 │ debg created user dashboard_all
[00:07:28]                 │ proc [kibana]   log   [17:05:41.931] [warning][api-authorization][plugins][security] User not authorized for "/api/solutions/security/graphql": responding with 403
[00:07:28]                 │ info java.lang.OutOfMemoryError: Java heap space
[00:07:28]                 │      Dumping heap to data/java_pid130252.hprof ...
[00:07:30]                 │ info Heap dump file created [921849517 bytes in 2.157 secs]
[00:07:30]                 │ info [o.e.m.j.JvmGcMonitorService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] [gc][473] overhead, spent [428ms] collecting in the last [1.1s]
[00:07:30]                 │ info [o.e.b.ElasticsearchUncaughtExceptionHandler] [kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891] fatal error in thread [elasticsearch[kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891][system_write][T#1]], exiting
[00:07:30]                 │      java.lang.OutOfMemoryError: Java heap space
[00:07:30]                 │      	at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:88) ~[?:?]
[00:07:30]                 │      	at java.lang.StringBuilder.<init>(StringBuilder.java:115) ~[?:?]
[00:07:30]                 │      	at com.fasterxml.jackson.core.util.TextBuffer.contentsAsString(TextBuffer.java:416) ~[jackson-core-2.10.4.jar:2.10.4]
[00:07:30]                 │      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2439) ~[jackson-core-2.10.4.jar:2.10.4]
[00:07:30]                 │      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:294) ~[jackson-core-2.10.4.jar:2.10.4]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.json.JsonXContentParser.text(JsonXContentParser.java:80) ~[elasticsearch-x-content-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.readValueUnsafe(AbstractXContentParser.java:390) ~[elasticsearch-x-content-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.readMapEntries(AbstractXContentParser.java:324) ~[elasticsearch-x-content-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.readMapSafe(AbstractXContentParser.java:313) ~[elasticsearch-x-content-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.map(AbstractXContentParser.java:263) ~[elasticsearch-x-content-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:175) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:123) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.index.IndexRequest.sourceAsMap(IndexRequest.java:340) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.update.UpdateHelper.prepareUpdateIndexRequest(UpdateHelper.java:180) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:80) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:64) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:180) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:173) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:60) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$ShardTransportHandler$1.doRun(TransportInstanceSingleOperationAction.java:264) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:728) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:07:30]                 │      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[?:?]
[00:07:30]                 │      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[?:?]
[00:07:30]                 │      	at java.lang.Thread.run(Thread.java:831) [?:?]
[00:07:30]                 │ERROR fatal error in thread [elasticsearch[kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891][system_write][T#1]], exiting
[00:07:30]                 │      
[00:07:30]                 │ERROR java.lang.OutOfMemoryError: Java heap space
[00:07:30]                 │      	at java.base/java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:88)
[00:07:30]                 │      	at java.base/java.lang.StringBuilder.<init>(StringBuilder.java:115)
[00:07:30]                 │      	at com.fasterxml.jackson.core.util.TextBuffer.contentsAsString(TextBuffer.java:416)
[00:07:30]                 │      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2439)
[00:07:30]                 │      	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:294)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.json.JsonXContentParser.text(JsonXContentParser.java:80)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.readValueUnsafe(AbstractXContentParser.java:390)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.readMapEntries(AbstractXContentParser.java:324)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.readMapSafe(AbstractXContentParser.java:313)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.support.AbstractXContentParser.map(AbstractXContentParser.java:263)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:175)
[00:07:30]                 │      	at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:123)
[00:07:30]                 │      	at org.elasticsearch.action.index.IndexRequest.sourceAsMap(IndexRequest.java:340)
[00:07:30]                 │      	at org.elasticsearch.action.update.UpdateHelper.prepareUpdateIndexRequest(UpdateHelper.java:180)
[00:07:30]                 │      	at org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:80)
[00:07:30]                 │      	at org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:64)
[00:07:30]                 │      	at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:180)
[00:07:30]                 │      	at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:173)
[00:07:30]                 │      	at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(TransportUpdateAction.java:60)
[00:07:30]                 │      	at org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$ShardTransportHandler$1.doRun(TransportInstanceSingleOperationAction.java:264)
[00:07:30]                 │      	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:728)
[00:07:30]                 │      	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
[00:07:30]                 │      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[00:07:30]                 │      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[00:07:30]                 │      	at java.base/java.lang.Thread.run(Thread.java:831)
[00:07:30]                 │      
[00:07:31]                 │ proc [kibana]   log   [17:05:44.950] [error][elasticsearch] Request error, retrying
[00:07:31]                 │ proc [kibana] GET http://localhost:61102/_xpack?accept_enterprise=true => socket hang up
[00:07:31]                 │ proc [kibana]   log   [17:05:44.955] [warning][elasticsearch] Unable to revive connection: http://localhost:61102/
[00:07:31]                 │ proc [kibana]   log   [17:05:44.956] [warning][elasticsearch] No living connections
[00:07:31]                 │ proc [kibana]   log   [17:05:44.957] [warning][licensing][plugins] License information could not be obtained from Elasticsearch due to Error: No Living connections error
[00:07:31]                 │ proc [kibana]   log   [17:05:44.959] [info][plugins][searchprofiler] You cannot use searchprofiler because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.960] [info][painlessLab][plugins] You cannot use painlessLab because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.960] [info][plugins][watcher] You cannot use watcher because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.964] [info][plugins][snapshotRestore] You cannot use snapshot_restore because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.964] [info][indexManagement][plugins] You cannot use index_management because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.964] [info][plugins][rollup] You cannot use rollup because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.965] [info][plugins][remoteClusters] You cannot use Remote Clusters because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.965] [info][crossClusterReplication][plugins] You cannot use crossClusterReplication because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.965] [info][indexLifecycleManagement][plugins] You cannot use index_lifecycle_management because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.965] [info][plugins][transform] You cannot use transform because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.965] [info][ingestPipelines][plugins] You cannot use ingest_pipelines because license information is not available at this time.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.974] [info][kibana-monitoring][monitoring][monitoring][plugins] Monitoring status upload endpoint is not enabled in Elasticsearch:Monitoring stats collection is stopped
[00:07:31]                 │ debg deleting role dashboard_all
[00:07:31]                 │ proc [kibana]   log   [17:05:44.989] [warning][plugins][securitySolution] Unable to verify endpoint policies in line with license change: failed to fetch package policies: connect ECONNREFUSED 127.0.0.1:61102
[00:07:31]                 │ proc [kibana]   log   [17:05:44.991] [error][authentication][plugins][security] License is not available, authentication is not possible.
[00:07:31]                 │ proc [kibana]   log   [17:05:44.994] [warning][elasticsearch] Unable to revive connection: http://localhost:61102/
[00:07:31]                 │ proc [kibana]   log   [17:05:44.995] [warning][elasticsearch] No living connections
[00:07:31]                 │ proc [kibana]   log   [17:05:44.995] [warning][licensing][plugins] License information could not be obtained from Elasticsearch due to Error: No Living connections error
[00:07:31]                 └- ✖ fail: apis SecuritySolution Endpoints feature controls APIs can't be accessed by user with dashboard "all" privileges
[00:07:31]                 │      Error: Request failed with status code 503
[00:07:31]                 │       at createError (/dev/shm/workspace/parallel/10/kibana/node_modules/axios/lib/core/createError.js:16:15)
[00:07:31]                 │       at settle (/dev/shm/workspace/parallel/10/kibana/node_modules/axios/lib/core/settle.js:17:12)
[00:07:31]                 │       at IncomingMessage.handleStreamEnd (/dev/shm/workspace/parallel/10/kibana/node_modules/axios/lib/adapters/http.js:260:11)
[00:07:31]                 │       at endReadableNT (internal/streams/readable.js:1327:12)
[00:07:31]                 │       at processTicksAndRejections (internal/process/task_queues.js:80:21)
[00:07:31]                 │ 
[00:07:31]                 │ 

Stack Trace

Error: Request failed with status code 503
    at createError (/dev/shm/workspace/parallel/10/kibana/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/dev/shm/workspace/parallel/10/kibana/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/dev/shm/workspace/parallel/10/kibana/node_modules/axios/lib/adapters/http.js:260:11)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  config: {
    url: 'http://elastic:changeme@localhost:61101/api/security/role/dashboard_all',
    method: 'delete',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'kbn-xsrf': 'kbn-client',
      'User-Agent': 'axios/0.21.1'
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    paramsSerializer: [Function: paramsSerializer],
    timeout: 0,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    httpsAgent: null,
    validateStatus: [Function: validateStatus],
    data: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      socket: [Function (anonymous)],
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      connect: [Function (anonymous)],
      error: [Function (anonymous)],
      timeout: [Function (anonymous)],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: false,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: 0,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'localhost',
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      parser: null,
      _httpMessage: [Circular *1],
      write: [Function: writeAfterFIN],
      [Symbol(async_id_symbol)]: 2319351,
      [Symbol(kHandle)]: null,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 477,
      [Symbol(kBytesWritten)]: 232,
      [Symbol(RequestTimeout)]: undefined
    },
    _header: 'DELETE /api/security/role/dashboard_all HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'kbn-xsrf: kbn-client\r\n' +
      'User-Agent: axios/0.21.1\r\n' +
      'Host: localhost:61101\r\n' +
      'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: noopPendingOutput],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 80,
      protocol: 'http:',
      options: [Object],
      requests: {},
      sockets: {},
      freeSockets: {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'fifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 0,
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'DELETE',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: '/api/security/role/dashboard_all',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      socket: [Socket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      headers: [Object],
      rawHeaders: [Array],
      trailers: {},
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 503,
      statusMessage: 'Service Unavailable',
      client: [Socket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'http://elastic:changeme@localhost:61101/api/security/role/dashboard_all',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(RequestTimeout)]: undefined
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'localhost',
    protocol: 'http:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'http://elastic:changeme@localhost:61101/api/security/role/dashboard_all',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'kbn-xsrf': [Array],
      'user-agent': [Array],
      host: [Array],
      authorization: [Array]
    }
  },
  response: {
    status: 503,
    statusText: 'Service Unavailable',
    headers: {
      'retry-after': '30',
      'kbn-name': 'kibana-ci-immutable-ubuntu-18-tests-xxl-1619366644694527891',
      'kbn-license-sig': '3f2fbe2e7dffe9936f647deadcb18d812ffbb4f02c27cd5d8ed8069fef195573',
      'content-type': 'application/json; charset=utf-8',
      'cache-control': 'private, no-cache, no-store, must-revalidate',
      'content-length': '86',
      date: 'Sun, 25 Apr 2021 17:05:44 GMT',
      connection: 'close'
    },
    config: {
      url: 'http://elastic:changeme@localhost:61101/api/security/role/dashboard_all',
      method: 'delete',
      headers: [Object],
      transformRequest: [Array],
      transformResponse: [Array],
      paramsSerializer: [Function: paramsSerializer],
      timeout: 0,
      adapter: [Function: httpAdapter],
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      httpsAgent: null,
      validateStatus: [Function: validateStatus],
      data: undefined
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Socket],
      _header: 'DELETE /api/security/role/dashboard_all HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'kbn-xsrf: kbn-client\r\n' +
        'User-Agent: axios/0.21.1\r\n' +
        'Host: localhost:61101\r\n' +
        'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'DELETE',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/api/security/role/dashboard_all',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'localhost',
      protocol: 'http:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    data: {
      statusCode: 503,
      error: 'Service Unavailable',
      message: 'License is not available.'
    }
  },
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 379.7KB 379.7KB -50.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @lukeelmers

@mshustov
Copy link
Contributor

mshustov commented May 8, 2021

closed in favor of #85027 removing defaultsDeep

@mshustov mshustov closed this May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:uiSettings performance release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.12.2 v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] uiSettingsClient.getRaw function is slow because of its use of _.defaultDeep
7 participants