Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Oct 26, 2019

Fixes #609
Fixes #608

@mgravell

@JamesNK JamesNK force-pushed the mgravell-mgravell/basic-buffer-writer branch from 293b9b5 to 80b18d9 Compare October 26, 2019 05:10
@JamesNK
Copy link
Member Author

JamesNK commented Oct 26, 2019

Before:

          Method |     Mean |     Error |    StdDev |      Op/s | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
---------------- |---------:|----------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
 HandleCallAsync | 2.794 us | 0.0533 us | 0.0654 us | 357,894.2 |      0.2098 |           - |           - |               880 B |

After:

                   Method |     Mean |     Error |    StdDev |      Op/s | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
------------------------- |---------:|----------:|----------:|----------:|------------:|------------:|------------:|--------------------:|
 PipelinesHandleCallAsync | 2.472 us | 0.0296 us | 0.0262 us | 404,545.4 |      0.0687 |           - |           - |               296 B |

@mgravell
Copy link
Contributor

Wow, it looks like you implemented option 3; gotta say: I'm impressed. Way to over-deliver!

@JamesNK JamesNK requested a review from JunTaoLuo October 29, 2019 19:52
Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

Some minor comments

Copy link
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

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

Overall looks goods but had a few questions.

}
else
{
GrpcServerLog.SerializedMessage(_serverCallContext.Logger, _serverCallContext.MethodContext.ResponseType, _payloadLength.GetValueOrDefault());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think upon completion we should check that we've actually written the right amount of bytes to match the announced message size, otherwise we will get a protocol error at the peer (and that's something that's potentially hard to debug?)

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 chose not to because this code will only be overridden by frameworks. They should test they are doing the right thing themselves using unit/functional tests.

Checking every serialization feels wasteful.

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'm going to commit this as it is. If you think this is important, or there are bug reports around this issue after release, then it can be added later by wrapping the buffer writer returned.

@JamesNK JamesNK force-pushed the mgravell-mgravell/basic-buffer-writer branch from 4ee266b to a592761 Compare October 30, 2019 22:45
@JamesNK JamesNK force-pushed the mgravell-mgravell/basic-buffer-writer branch from a592761 to ecc8f79 Compare October 30, 2019 22:50
@JamesNK JamesNK merged commit 542066a into grpc:master Oct 30, 2019
@JamesNK JamesNK deleted the mgravell-mgravell/basic-buffer-writer branch October 30, 2019 23:06
@ejona86
Copy link
Member

ejona86 commented Oct 31, 2019

This seems to have broken compatibility with grpc-java. I think it is because the gzip stream isn't "finish"ed. We can discuss on grpc/grpc#20884.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement SerializationContext.GetBufferWriter Add using block for Created Compression Stream

5 participants