Skip to content

Performance fix. Reduce deprecation calls for the same bulk request #37415

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

Merged
merged 1 commit into from
Jan 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null
int from = 0;
int length = data.length();
byte marker = xContent.streamSeparator();
boolean typesDeprecationLogged = false;
while (true) {
int nextMarker = findNextMarker(marker, from, data, length);
if (nextMarker == -1) {
Expand Down Expand Up @@ -427,7 +428,10 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null
}
index = parser.text();
} else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
deprecationLogger.deprecatedAndMaybeLog("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
if (typesDeprecationLogged == false) {
deprecationLogger.deprecatedAndMaybeLog("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
typesDeprecationLogged = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a test that checks that only 1 deprecation warning is returned when the bulk request would previously generate multiple?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they're thinned out already in DeprecationLogger/ThreadContext?
It dedups values added to the response header
This PR just adds a more performant way of thinning them out.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I see. In which case I think we should test to make sure this actually fixes the performance issue before we merge it as I didn't see that we already deduplicate the warning headers. Maybe we can run one of the rally tracks against this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll ask

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to fix the drop.

With the earlier commit (4344305) geopoint default had the following indexing throughput:

|   All |                                                 Min Throughput | index-append |    216469 | docs/s |
|   All |                                              Median Throughput | index-append |    220417 | docs/s |
|   All |                                                 Max Throughput | index-append |    222044 | docs/s |

whereas with this commit:

|   All |                                                 Min Throughput | index-append |     302604 | docs/s |
|   All |                                              Median Throughput | index-append |     312456 | docs/s |
|   All |                                                 Max Throughput | index-append |     315466 | docs/s |

which seems to be roughly the same performance we had before the pending PR/commit i.e. using 04dcb13:


|   All |                                                 Min Throughput | index-append |    312749 | docs/s |
|   All |                                              Median Throughput | index-append |    316424 | docs/s |
|   All |                                                 Max Throughput | index-append |    318845 | docs/s |

For the record the Rally command in a 1node env with separate load generator:

rally --skip-update --configuration-name=adhoc --target-host="192.168.14.13:39200" --track="geopoint" --car="defaults" --challenge="append-no-conflicts" --user-tag="env:bare,name:geopoint-append-defaults-1node" --pipeline="from-sources-complete" --revision="4344305" --include-tasks="delete-index,create-index,check-cluster-health,index-append,refresh-after-index,force-merge,refresh-after-force-merge" --user-tag="geopoint:regression"

vs

rally --skip-update --configuration-name=adhoc --target-host="192.168.14.13:39200" --track="geopoint" --car="defaults" --challenge="append-no-conflicts" --user-tag="env:bare,name:geopoint-append-defaults-1node" --pipeline="from-sources-skip-build" --revision="72f71a0e" --include-tasks="delete-index,create-index,check-cluster-health,index-append,refresh-after-index,force-merge,refresh-after-force-merge" --user-tag="geopoint:fix"

type = parser.text();
} else if (ID.match(currentFieldName, parser.getDeprecationHandler())) {
id = parser.text();
Expand Down