KEMBAR78
[DebuggerV2] Use more efficient read in /execution/data and /graph_execution/data routes by caisq · Pull Request #3526 · tensorflow/tensorboard · GitHub
Skip to content

Conversation

@caisq
Copy link
Contributor

@caisq caisq commented Apr 17, 2020

  • Motivation for features / changes
    • Fix a performance issue in the HTTP route /graph_execution/data
    • The issue has to do with the fact that DebugDataMultiplexer.GraphExecutionData() uses the inefficient approach of reading all the GraphExecutionTraces first and then slice the array. A much more efficient approach (analogous to the DebugDataMultiplexer.ExecutionData() for top-level executions) is to use the range reading support of DebugDatataReader.graph_execution_traces() that is now available.
    • Similarly, use the range reading support of DebugDatataReader.execution() in the /execution/data route.
  • Technical description of changes
    • See the description above. Use range reading support of DebugDatataReader.execution() and DebugDatataReader.graph_execution_trace().
    • Also, remove an extraneous element in the json response (num_digests). It is not in the design spec and was included due to oversight on my part.
  • Detailed steps to verify changes work correctly (as executed by you)
    • No new unit tests are required to verify the correctness of the new implementation. The existing ones suffice.
    • Manual testing in the web GUI to confirm much more efficient loading.

@caisq caisq requested a review from wchargin April 17, 2020 14:10
Copy link
Contributor

@wchargin wchargin left a comment

Choose a reason for hiding this comment

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

This is replacing a single query with a classic “n + 1 queries”
problem. We’ve just gone to a bunch of work to remove query patterns
like this from the hparams plugin. Can we instead make the reader accept
a begin/end step range so that you only need one query that returns
exactly what’s needed?

@caisq caisq changed the title [DebuggerV2] Fix a performance bug in /graph_execution/data [DebuggerV2] Use more efficient read in /execution/data and /graph_execution/data routes Apr 24, 2020
@caisq
Copy link
Contributor Author

caisq commented Apr 24, 2020

@wchargin Thanks for the review and comment.

I've updated this PR. The underlying methods of DebugDataReader now support range reading with the begin and end kwargs in its execution() and graph_execution_trace() methods. I'm using them in this PR now. This avoids the N + 1 request problem and makes the implementation consistent between (eager) execution and intra-graph execution.

PTAL.

@caisq caisq requested a review from wchargin April 24, 2020 17:20
Copy link
Contributor

@wchargin wchargin left a comment

Choose a reason for hiding this comment

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

Perfect; thank you!

@caisq caisq merged commit ab9298a into tensorflow:master Apr 24, 2020
caisq added a commit to caisq/tensorboard that referenced this pull request May 19, 2020
…ecution/data routes (tensorflow#3526)

* Motivation for features / changes
  * Fix a performance issue in the HTTP route /graph_execution/data
  * The issue has to do with the fact that `DebugDataMultiplexer.GraphExecutionData()` uses the inefficient approach of reading all the `GraphExecutionTrace`s first and then slice the array. A much more efficient approach (analogous to the `DebugDataMultiplexer.ExecutionData()` for top-level executions) is to use the range reading support of `DebugDatataReader.graph_execution_traces()` that is now available.
  * Similarly, use the range reading support of `DebugDatataReader.execution()` in the `/execution/data` route.
* Technical description of changes
  * See the description above. Use range reading support of `DebugDatataReader.execution()` and `DebugDatataReader.graph_execution_trace()`.
  * Also, remove an extraneous element in the json response (`num_digests`). It is not in the design spec and was included due to oversight on my part.
* Detailed steps to verify changes work correctly (as executed by you)
  * No new unit tests are required to verify the correctness of the new implementation. The existing ones suffice. 
  * Manual testing in the web GUI to confirm much more efficient loading.
caisq added a commit that referenced this pull request May 27, 2020
…ecution/data routes (#3526)

* Motivation for features / changes
  * Fix a performance issue in the HTTP route /graph_execution/data
  * The issue has to do with the fact that `DebugDataMultiplexer.GraphExecutionData()` uses the inefficient approach of reading all the `GraphExecutionTrace`s first and then slice the array. A much more efficient approach (analogous to the `DebugDataMultiplexer.ExecutionData()` for top-level executions) is to use the range reading support of `DebugDatataReader.graph_execution_traces()` that is now available.
  * Similarly, use the range reading support of `DebugDatataReader.execution()` in the `/execution/data` route.
* Technical description of changes
  * See the description above. Use range reading support of `DebugDatataReader.execution()` and `DebugDatataReader.graph_execution_trace()`.
  * Also, remove an extraneous element in the json response (`num_digests`). It is not in the design spec and was included due to oversight on my part.
* Detailed steps to verify changes work correctly (as executed by you)
  * No new unit tests are required to verify the correctness of the new implementation. The existing ones suffice. 
  * Manual testing in the web GUI to confirm much more efficient loading.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants