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

Search profiling for fetch phases #75892

Closed
nik9000 opened this issue Jul 30, 2021 · 4 comments · Fixed by #77064
Closed

Search profiling for fetch phases #75892

nik9000 opened this issue Jul 30, 2021 · 4 comments · Fixed by #77064
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@nik9000
Copy link
Member

nik9000 commented Jul 30, 2021

I was helping some folks to debug a thing this morning and we had questions about the fetch performance and I was sad that we didn't profile the fetch phase. And I realized I had the same issue a week ago when I was helping some other folks. And I'd had the issue many more times before that.

Do folks think it'd be worth profiling the fetch phase?

I know a big chunk of the fetch phase is spent loading stored fields needed by the other phases. But I don't know how much of the time is that vs time spent chewing on the data or on docvalue_fields or whatever.

@nik9000 nik9000 added >enhancement :Search/Search Search-related issues that do not fall into other categories team-discuss labels Jul 30, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jul 30, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@nik9000
Copy link
Member Author

nik9000 commented Aug 26, 2021

I've been working on prototypes for other things for so long I needed to take some time to do something "contained" so I made a prototype:

      {
        "id" : "[1uXDrrPjSfu7W0KA-703jQ][test][2]",
        "searches" : [ ... ],
        "aggregations" : [ ],
        "fetch" : {
          "type" : "fetch",
          "description" : "fetch",
          "time_in_nanos" : 5268936,
          "breakdown" : {
            "load_stored_fields" : 2893202,
            "load_stored_fields_count" : 357,
            "next_reader" : 20702,
            "next_reader_count" : 1
          },
          "debug" : {
            "stored_fields" : [
              "_id",
              "_routing",
              "_source"
            ]
          },
          "children" : [
            {
              "type" : "doc_values",
              "description" : "fetches doc_values",
              "time_in_nanos" : 221701,
              "breakdown" : {
                "process_count" : 357,
                "process" : 211053,
                "next_reader" : 10648,
                "next_reader_count" : 1
              }
            },
            {
              "type" : "source",
              "description" : "load _source",
              "time_in_nanos" : 484075,
              "breakdown" : {
                "process_count" : 357,
                "process" : 483912,
                "next_reader" : 163,
                "next_reader_count" : 1
              }
            }
          ]
        }
      }

@jpountz
Copy link
Contributor

jpountz commented Aug 31, 2021

Do folks think it'd be worth profiling the fetch phase?

Totally. I think that the only reason why it's not done today is that the query phase is a more common bottleneck, but I remember seeing cases in the past when the fetch phase was a bottleneck too, so +1 to add profiling to the fetch phase.

@nik9000
Copy link
Member Author

nik9000 commented Aug 31, 2021 via email

nik9000 added a commit to nik9000/elasticsearch that referenced this issue Aug 31, 2021
This adds profiling to the fetch phase so we can tell when fetching is
slower than we'd like and we can tell which portion of the fetch is
slow. The output includes which stored fields were loaded, how long it
took to load stored fields, which fetch sub-phases were run, and how
long those fetch sub-phases took.

Closes elastic#75892
nik9000 added a commit that referenced this issue Sep 13, 2021
This adds profiling to the fetch phase so we can tell when fetching is
slower than we'd like and we can tell which portion of the fetch is
slow. The output includes which stored fields were loaded, how long it
took to load stored fields, which fetch sub-phases were run, and how
long those fetch sub-phases took.

Closes #75892

* Skip bwc

* Don't compare fetch profiles

* Use passed one

* no npe

* Do last rename

* Move method down

* serialization tests

* Fix sneaky serialization

* Test for sneaky bug

* license header

* Document

* Fix test

* newline

* Restore assertion

* unit test merging

* Handle inner hits

* Fixup

* Revert unneeded

* Revert inner hits profiling

* Fix names

* Fixup names

* Move results building

* Drop loaded_nested

* Checkstyle

* Fixup more

* Finish writeable cleanup

Add unit tests for merge

* Remove null checking builder

* Fix wire mistake

How did this pass before?!

* Rename

* Remove funny builder

* Remove name munging
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Sep 13, 2021
This adds profiling to the fetch phase so we can tell when fetching is
slower than we'd like and we can tell which portion of the fetch is
slow. The output includes which stored fields were loaded, how long it
took to load stored fields, which fetch sub-phases were run, and how
long those fetch sub-phases took.

Closes elastic#75892
nik9000 added a commit that referenced this issue Sep 13, 2021
This adds profiling to the fetch phase so we can tell when fetching is
slower than we'd like and we can tell which portion of the fetch is
slow. The output includes which stored fields were loaded, how long it
took to load stored fields, which fetch sub-phases were run, and how
long those fetch sub-phases took.

Closes #75892
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants