Commit Graph

508 Commits

Author SHA1 Message Date
Eric Anderson 393ebf7cdd netty,okhttp: handle ENHANCE_YOUR_CALM and too_many_pings
Any ENHANCE_YOUR_CALM is good reason to log, but too_many_pings also
triggers increase of the keepalive time for later connections.
2017-04-17 14:25:16 -07:00
Kun Zhang 6618f9739e core: add inboundHeaders() to ClientStreamTracer. (#2921)
Also renamed headersSent to outboundHeaders
2017-04-17 14:01:34 -07:00
ZHANG Dapeng 75324e9918 netty: fix flaky max connection age tests using sleepAtLeast
resolves #2898
2017-04-14 09:42:42 -07:00
ZHANG Dapeng ffc64b70bb netty: move connection.addListner inside constructor of NettyServerHandler
For convenience of implementing max connection idle.
2017-04-13 14:34:18 -07:00
Carl Mastrangelo be61af42e9 core: use RESOURCE_EXHAUSTED for max message size failures 2017-04-13 08:35:48 -07:00
ZHANG Dapeng f1de741a2a netty: ignore flaky max connection age tests
#2898
2017-04-10 16:06:07 -07:00
Eric Anderson b56a728502 all: Use "keepalive time" instead of "keepalive delay"
It should have always been 'time', to match the terminology of TCP
Keepalive.
2017-04-10 15:48:18 -07:00
Eric Anderson af4982b763 netty,okhttp: Allow keepalive without calls
Again, the server can enforce this, so clients shouldn't go wild with
their new-found freedom.
2017-04-10 15:48:18 -07:00
Eric Anderson 0277b91762 okhttp,netty: Normalize client-side keepalive APIs
This improves the docs a bit and makes OkHttp look like Netty.
2017-04-10 15:48:18 -07:00
ZHANG Dapeng 81da785f75 netty: add jitter to max connection age 2017-04-10 13:38:47 -07:00
ZHANG Dapeng 83a06cc1a5 netty: implement server max connection age 2017-04-10 11:32:28 -07:00
Eric Anderson cfc6634650 netty: Pass boolean to builder instead of permit/deny specialized naming
While we can use permit/deny in this one case, it isn't generalizable to
other cases. In order to avoid always questioning how to deal with
boolean config options, just pass the boolean in all cases.

This mirrors what is being done with the client-side's
keepAliveWithoutCalls.

These methods were very recently added, so there is a low risk of
breakage.
2017-04-10 10:34:03 -07:00
Kun Zhang 903197b2aa core: StreamTracer (#2863)
Background
==========

LoadBalancer needs to track RPC measurements and status for
load-reporting.  We need to introduce a "Tracer" API for that.

Since such API is very close to the current
Census(instrumentation)-based stats reporting mechanism in terms of what
are recorded, we will migrate the Census-based stats reporting under the
new Tracer API.

Alternatives
============

We considered plumbing the LB-related information from the LoadBalancer
to the core, and recording those information along with the currently
recorded stats to Census. The LB-related information, such as LB_ID,
reason for dropping reqeusts etc, would be added to the Census
StatsContext as tags.

Since tags are held by StatsContext before eventually being recorded by
providing the measurements, and StatsContext is immutable, this would
require a way for LoadBalancer to override the StatsContext, which means
LoadBalancer API would has direct reference to the Census StatsContext.
This is undesirable because Census API is not stable yet.

Part of the LB-related information is whether the client has received
the initial headers from the server.  While such information can be
grabbed by implementing a ClientInterceptor, it must be recorded along
with other information such as LB_ID to be useful, and LB_ID is only
available in GrpclbLoadBalancer.

Bottom line, trying to use solely the Census StatsContext API to record
LB load information would require extra data plumbing channel between
ClientInterceptor, LoadBalancer and the gRPC core, as well as exposing
Census API on the gRPC API.  Even with those extensive changes, we are
yet to find a working solution. Therefore, we abandoned this idea and
propose this PR.

Summary of changes
==================

API summary
-----------
Introduce "StreamTracer" API, a callback interface for receiving stats
and tracing related updates concerning **a single stream**.
"ClientStreamTracer" and "ServerStreamTracer" add side-specific
events. A stream can have zero or more tracers and report to all of
them.

On the client-side, CallOptions now takes a list of
ClientStreamTracer.Factory. Opon creating a ClientStream, each of the
factory creates a ClientStreamTracer for the stream. This allows
ClientInterceptors to install its own tracer factories by overriding the
CallOptions.

Since StreamTracer only tracks the span of a stream, tracking of a
ClientCall needs to be done in a ClientInterceptor.  By installing its
own StreamTracer when a ClientCall is created, ClientInterceptor can
associate the updates for a Call with the updates for the Streams
created for that Call.  This is how we keep the existing Census
reporting mechanism in CensusStreamTracerModule.

On the server-side, ServerStreamTracer.Factory is added through the
ServerBuilder, and is used to create ServerStreamTracers for every
ServerStream.

The Tracer API supports propagation of stats/tracing information through
Context and metadata.  Both client-side and server-side tracer factories
have access to the headers object.  Client-side tracer relies on
interceptor to read the Context, while server-side tracer has
filterContext() method that can override the Context.

Implementation details
----------------------

Only real streams report stats.  Pseudo streams such as delayed stream,
failing stream don't report.  InProcess transport streams currently
don't report stats.

"StatsTraceContext" which used to receive updates from core and report
directly to Census (StatsContext), now delegates to the StreamTracers of
a stream.  On the client-side, the scope of a StatsTraceContext reduces
from ClientCall to a ClientStream to match the scope of StreamTracer.

The Census-specific logic that was in StatsTraceContext is moved into
CensusStreamTracerModule, which produces factories for StreamTracers
that report to Census.

Reporting with StatsTraceContext is moved out of the Channel/Call layer
into Transport/Stream layer, to match the scope change of
StatsTraceContext.

Bug fixed
----------------

The end of a server-side call was reported in ServerCallImpl's
ServerStreamListenerImpl.closed(), which was wrong.  Because closed()
receiving OK doesn't necessarily mean the RPC ended with OK.  Instead it
means the server has successfully sent the final status, which may be
non-OK, to the client.

Now the end report is done in both ServerStream.close(any Status) and
before calling ServerStreamListener.closed(non-OK).  Whichever happens
first is the reported status.

TODOs
=====

A follow-up change to the LoadBalancer API will add a
ClientStreamTracer.Factory to the PickResult to complete the API needed
by load-reporting.
2017-04-07 11:03:24 -07:00
Eric Anderson 4236027713 netty: Add config for server keepalive enforcement
Now that there is a config, the new defaults are now being enabled.
Previously there were no default limits. Now keepalives may not be more
frequent than every 5 minutes and only when there are outstanding RPCs.
2017-04-06 15:48:33 -07:00
Eric Anderson 3818087aa4 netty: Handle channel creation failure
Something "very bad" has happened, but without grpc propagating the
cause from the Future it is very difficult to figure out what.

Fixes #2296
2017-04-06 11:11:49 -07:00
ZHANG Dapeng 1c1864be73 netty: refactor NettyChannelBuilder keepalive API (#2874)
To be in line with `NettyServerBuilder` APIs
- Deprecated `enableKeepAlive(boolean enable)` and
`enableKeepAlive(boolean enable, long keepAliveDelay, TimeUnit delayUnit, long keepAliveTimeout, 
TimeUnit timeoutUnit)`
which never worked in v1.2

- Added `keepAliveTime(long keepAliveTime, TimeUnit timeUnit)` and
`keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)`
2017-04-04 18:19:41 -07:00
Eric Anderson 90788305a3 netty: Add server keepalive enforcement
Everything is currently permitted, but I've tested with other
configurations and all tests pass. I'll set the restrictive default at
the same time as adding a configuration API.
2017-04-04 16:47:42 -07:00
Eric Anderson f9eb545df0 netty: Fix client keepalive initialization (again)
d116cc9 fixed the NPE, but the initialization of the manager happened
_after_ newHandler() was called, so a null manager was passed to the
handler.

Fixes #2828
2017-03-31 17:21:33 -07:00
ZHANG Dapeng c4bbe66506 netty: expose server side keepalive API
expose server side keepalive API in NettyServerBuilder
2017-03-31 10:35:03 -07:00
Eric Anderson 4096d4b668 core,netty: support GET verb in AbstractClientStream2 2017-03-30 14:18:14 -07:00
ZHANG Dapeng 8114b93113 netty: Server side keep alive
use KeepAliveManager in NettyServerHandler
2017-03-30 09:24:04 -07:00
ZHANG Dapeng 6789eac581 core,netty,okhttp: KeepAliveManager with Pinger
Modified KeepAliveManager to use a Pinger interface, which can send ping or shutdown transport for both server and client.
2017-03-23 13:34:19 -07:00
Carl Mastrangelo ee12cc2a34 all: update to latest version of errorprone 2017-03-22 22:09:04 -07:00
ZHANG Dapeng 3ffa5a9660 Okhttp: keepAlivedManager#onTransportShutdown moved from shutdown to stopIfNecessary and refactored
`keepAlivedManager#onTransportshutdown` should not be called in `transport.shutdown()` because it is possible that there are still open RPC streams, and maybe inactive, so keepalive is still needed.
2017-03-22 10:26:45 -07:00
ZHANG Dapeng a14689eff8 netty: move startWriteQueue right after channel is constructed
Now that the commit 65e4d9f has split the channel instantiation and `connect()`, we can `startWriteQueue()` even earlier.
2017-03-20 11:54:57 -07:00
Eric Anderson 19afd8b48b core: Support keepalive even when transport is idle
Nothing is using this yet, but it will be used on both client and
server.
2017-03-15 17:15:19 -07:00
Eric Anderson 2cb6ecc3b3 netty: Backport SETTINGS ACK sequencing fix
This fix was made in netty/netty#6521. Fixes #2801
2017-03-14 14:21:51 -07:00
Eric Anderson 9ef07916f7 netty: Copy DefaultHttp2ConnectionDecoder in prep for backport 2017-03-14 14:21:51 -07:00
ZHANG Dapeng 891581f14d all: fix errorprones
fix JavaStyle and ErrorProne warnings found in internal weekly import:

- Calls to ExpectedException#expect should always be followed by exactly one statement.
- Do not mock 'java.util.concurrent.Future'
2017-03-06 10:45:42 -08:00
Kun Zhang 9c76b48356 netty/test: be less agreesive on checking cause
For #2762

If it doesn't fix the flaky test, status.toString() will print out the
whole stack trace so that we will know what's in there.
2017-03-03 10:31:34 -08:00
Eric Anderson c415dc8d40 netty: Use tcnative in tests instead of Jetty ALPN
I'm quite confused how we went this long using Jetty ALPN for the Netty
tests. Anyway, we strongly prefer tcnative, so we should be using it in
the tests.
2017-02-24 17:04:35 -08:00
Eric Anderson 675080b208 all: Enable ErrorProne during compilation
ErrorProne provides static analysis for common issues, including
misused variables GuardedBy locks.

This increases build time by 60% for parallel builds and 30% for
non-parallel, so I've provided a way to disable the check. It is on by
default though and will be run in our CI environments.
2017-02-24 14:53:23 -08:00
Lukasz Strzalkowski d116cc9875 netty: Fix NPE in NettyClientTransport
Fixes NPE when keepalive is enabled.

* Move creation of keepAliveManager to the bottom of start()
* Enable keepAlive in NettyClientTransportTest
* Add test cases checking if keepalive is enabled/disabled, specifically.

Fixes #2726
2017-02-16 10:29:52 -08:00
Eric Anderson ae68718881 netty: remove unused code in a test 2017-02-13 16:56:10 -08:00
Łukasz Strzałkowski 26913bb82e netty: include SETTINGS_MAX_HEADER_LIST_SIZE in SETTINGS
Closes #2350
2017-02-13 07:37:54 -08:00
Ryan Michela 4029b3f0c2 Implement missing authority API for HandlerRegistry 2017-02-10 17:19:20 -08:00
Eric Anderson cc000be12d netty: Fix CheckReturnValue failure in test 2017-02-09 17:16:19 -08:00
Eric Anderson 42aa64c647 all: swap to newer animalsniffer plugin
The new plugin uses a newer version of animalsniffer, allows overriding
the animalsniffer version used, and has up-to-date handling. The
up-to-date handling cuts fully incremental parallel build times in half,
from 5.5s to 2.7s.

The previous plugin was supposed to be verifying tests. However, either
it wasn't verifying them or its verification was broken.
2017-02-07 12:49:01 -08:00
Carl Mastrangelo dfe61e4ed3 netty: fix race in server channel startup and shutdown 2017-02-06 15:44:03 -08:00
Carl Mastrangelo 1928dc7779 netty: add return value errorprone annotations 2017-02-06 14:53:29 -08:00
Kun Zhang 7ab5e0e810 core: record server_elapsed_time on client (#2673)
It is defined as the time between the client sends out the headers, and the RPC finishes.
2017-02-03 13:29:06 -08:00
ZHANG Dapeng b1aee9fcc0 netty: call transportReady in handleProtocolNegotiationCompleted
implements the comments mentioned in #2619
2017-02-01 14:55:55 -08:00
Carl Mastrangelo fdeade4ee2 netty: work around netty bug when RPCs may be reset early
For netty/netty#6296
2017-01-30 16:09:19 -08:00
Carl Mastrangelo 0c0ce37bbd all: upgrade to netty 4.1.8 and tcnative Fork26 2017-01-30 12:40:46 -08:00
Eric Anderson 65e4d9f47a all: avoid DNS with GRPC_PROXY_EXP
In some environments DNS is not available and is performed by the
CONNECT proxy. Nothing "special" should need to be done for these
environments, but the previous support took shortcuts which knowingly
would not support such environments.

This change should fix both OkHttp and Netty. Netty's
Bootstrap.connect() resolved the name immediately whereas using
ChannelPipeline.connect() waits until the address reaches the end of the
pipeline. Netty uses NetUtil.toSocketAddressString() to get the name of
the address, which uses InetSocketAddress.getHostString() when
available.

OkHttp is still using InetSocketAddress.getHostName() which may issue
reverse DNS lookups. However, if the reverse DNS lookup fails, it should
convert the IP to a textual string like getHostString(). So as long as
the reverse DNS maps to the same machine as the IP, there should only be
performance concerns, not correctness issues. Since the DnsNameResolver
is creating unresolved addresses, the reverse DNS lookups shouldn't
occur in the common case.
2017-01-27 09:27:07 -08:00
Eric Anderson 23f5a6ff2a Add support for http forward proxy with CONNECT
This is a squash and modification of master commits that also includes:
netty,okhttp: Fix CONNECT and its error handling

This commit has been modified to reduce its size to substantially reduce
risk of it breaking Netty error handling. But that also means proxy
error handling just provides a useless "there was an error" sort of
message.

There is no Java API to enable the proxy support. Instead, you must set
the GRPC_PROXY_EXP environment variable which should be set to a
host:port string. The environment variable is temporary; it will not
exist in future releases. It exists to provide support without needing
explicit code to enable the future, while at the same time not risking
enabling it for existing users.
2017-01-27 09:27:07 -08:00
Łukasz Strzałkowski aa0391a427 core: pass down addr to which client is connected
This addresses #2613
2017-01-26 15:11:39 -08:00
Carl Mastrangelo 89bc2cd3b2 all: update to latest import ordering 2017-01-26 13:43:06 -08:00
Lukasz Strzalkowski b33d3cb170 core: rename getAttr() and use standard getAttributes() 2017-01-23 15:06:00 -08:00
Łukasz Strzałkowski 8882abaa09 core: rename attributes() -> getAttributes()
Make it consistent with its counterpart, ClientStream#getAttributes()
2017-01-23 15:04:51 -08:00
Carl Mastrangelo efbcd1f1b9 core: change method descriptor to be builder based 2017-01-23 12:29:35 -08:00
Carl Mastrangelo d5eb248737 all: bump to netty 4.1.7 2017-01-19 15:24:26 -08:00
Eric Anderson 1e99b299e1 all: ErrorProne fixes and avoid @Beta in Guava 2017-01-19 12:16:05 -08:00
ZHANG Dapeng d87a6587a4 core,netty: add getAttributes to ClientStream and ClientCall (#2526)
add `getAttributes()` to `ClientStream` and `ClientCall` to be able to share clientTransport
information such as socket TOS with higher lever API's, once the RPC picks up an active transport that is ready to use.
2017-01-17 20:33:37 -08:00
htuch 7fbee39c3a Introduce a grpc-exp ALPN protocol identifier
This patch introduces an additional ALPN protocol, grpc-exp, intended to
take preference to h2 and indicate to the server that the connection
contains only gRPC traffic. This allows servers and intermediate boxes
to distinguish gRPC from other HTTP/2 traffic.

The choice of grpc-exp as a protocol identifier indicates that this
scheme is currently experimental and should not be relied upon. The
protocol is not in the IANA TLS registry.

This is the grpc-java equivalent of
8cdf17a620.

Due to the opacity of ALPN and TLS negotiation at application level, the
tests are only there to validate that the lists we're feeding into the
negotiation process have the desired ordering properties:

  * If grpc-exp is present, h2 is as well.

  * grpc-exp is preferenced over h2.
2017-01-09 10:40:56 -08:00
ZHANG Dapeng bff6506f92 netty: no add_dep io.netty.handler.ssl.SslContext (#2529)
Not to expose dependency of `io.netty.handler.ssl.SslContext` when implementing `TransportCreationParamsFilter`

Change the `TransportCreationParamsFilter` API
````
ProtocolNegotiator getProtocolNegotiator(NegotiationType negotiationType, SslContext sslContext);
````
into
````
ProtocolNegotiator getProtocolNegotiator();
````
2016-12-16 16:20:31 -08:00
Carl Mastrangelo cb6cf1ae2f netty: refactor how internal netty channel works 2016-12-16 10:36:12 -08:00
ZHANG Dapeng e36eb10728 codehealth: errorprone, unused 2016-12-15 13:13:26 -08:00
Anuraag Agrawal 221fadcbdd Implement setListener in AbstractServerStream and remove from subclasses. 2016-12-14 12:29:10 -08:00
Carl Mastrangelo 677f05d7fb netty: move internal channel builder code to a special accessor 2016-12-13 11:17:00 -08:00
Łukasz Strzałkowski bd9e041b74 netty: Add support for keepalive 2016-12-12 09:02:24 -08:00
Lukasz Strzalkowski 483f3d55e9 Remove deadcode 2016-12-05 14:17:13 -08:00
Carl Mastrangelo 209a32fd1a core,netty: add a log id to the server and server transports 2016-12-05 09:47:35 -08:00
Carl Mastrangelo e9779d7c00 all: use a proper log id which can reference channels, subchannels, and transports 2016-12-02 15:35:11 -08:00
Carl Mastrangelo 5269a1b969 netty: call the client ssl negotiation handler
* netty: call the client ssl negotiation handler
2016-11-30 08:47:20 -08:00
ZHANG Dapeng e70f7b421c all: cleanup - errorprone, unused 2016-11-16 19:15:16 -08:00
ZHANG Dapeng 0d694c80ee core,netty: quick patch for setListener regression
resolves grpc/grpc#8715
now that setListener is called prior to
`JumpToApplicationThreadServerStreamListener` being completely ready to
use. We should not call `AbstractStream2#onStreamAllocated()` inside
`setListener()` anymore, but call it after `ServerImpl#streamCreated()`
is completed.
2016-11-11 19:39:16 -08:00
ZHANG Dapeng 0e27eef168 core: fix bug when stream listener not set before stream closed
Resolves #1936

Two bugs fixed:
- NPE in `ServerImpl#streamCreated()` when stream listener not set before
  stream closed
- It is possible that `internalCancel()` is called during
  `InProcessClientStream#start()` due to early server `onComplete()` or server `onError()`,
  in this case no need to enlist `streams`, otherwise the channel can not be shutdown by `shutdown()`.
2016-11-09 15:21:11 -08:00
ZHANG Dapeng e40668499c netty: add channel options in NettyChannelBuilder
Add `withOption(ChannelOption<T> option, T value)` method to
`NettyChannelBuilder`. This allows user to set a custom TOS.
2016-11-09 13:32:05 -08:00
Eric Anderson 78107a69c0 core: Do not rely on HTTP 200
We only want to use the HTTP code for errors, when the response is not
grpc. grpc status codes may be mapped to HTTP codes in the future, and
we don't want to break when that happens. We also don't want to ever
accidentally use Status.OK without receiving it from the server, even
for HTTP 200.
2016-11-01 17:35:15 -07:00
Carl Mastrangelo fdd062c465 core: make max message size part of the public API 2016-10-27 14:11:44 -07:00
Carl Mastrangelo 2417660687 netty: fix static data race on handler settings 2016-10-26 13:52:10 -07:00
Carl Mastrangelo 8702185e8c netty: use memory efficient slice in Buffer 2016-10-20 13:29:36 -07:00
Jakob Buchgraber 6fa63a6371 netty: Upgrade to 4.1.6 and tcnative Fork23. Fixes #2224 (#2349) 2016-10-20 00:24:58 +02:00
Jakob Buchgraber 10f4c90f4e core: Call onSentBytes only if future is successfull. (#2339)
For example, if opening a stream failed after a DATA frame had already been queued.
2016-10-17 19:23:19 +02:00
Jakob Buchgraber 1e1c71d74c netty: Add toString() to GrpcHttp2InboundHeaders. Fixes #2341. (#2342)
Binary header values are printed in their base64 encoded form.

The GrpcHttpOutboundHeaders, as mentioned in the issue, don't seem to be affected by this regression. The toString() method seems fine.
2016-10-14 18:57:08 +02:00
Jakob Buchgraber 96069958f6 netty: Remove RequestMessagesCommand (#2333)
It's not needed. Can do the same by scheduling a task on the eventloop.
2016-10-14 01:23:19 +02:00
Jakob Buchgraber 14cc0dbe2b netty: Special case Http2ChannelClosedException. Fixes #2279 (#2334) 2016-10-14 00:14:55 +02:00
Eric Anderson e7ce41dd94 all: Style, unused, and errorprone fixes 2016-10-12 16:57:01 -07:00
Kun Zhang 132f7a9a33 core: Census integration for stats (#2262)
Highlights
==========

StatsTraceContext
-----------------

The bridge between gRPC library and Census. It keeps track of the total
payload sizes and the elapsed time of a Call. The rest of the gRPC code
doesn't invoke Census directly.

Context propagation
-------------------

StatsTraceContext carries CensusContext (and the upcoming TraceContext)
and is attached to the gRPC Context.

1. StatsTraceContext is created by ManagedChannelImpl, by calling
createClientContext(), which inherits the current CensusContext if available.

2. ManagedChannelImpl passes StatsTraceContext to ClientCallImpl, then
to the stream, then to the framer and deframer explicitly.

3. ClientCallImpl propagates the CensusContext to the headers.

1. ServerImpl creates a StatsTraceContext by implementing a new callback
method StatsTraceContext methodDetermined(MethodDescriptor, Metadata) on
ServerTransportListener.

2. NettyServerHandler calls methodDetermined() before creating the
stream, and passes the StatsTraceContext to the stream.

3. When ServerImpl creates the gRPC Context for the new ServerCall, it
calls the new method statsTraceContext() on ServerStream and puts the
StatsTraceContext in the Context.

Metrics recording
-----------------

1. Client-side start time: when ClientCallImpl is created

2. Server-side start time: when methodDetermined() is called

3. Server-side end time: in ServerStreamListener.closed(), but before
calling onComplete() or onCancel() on ServerCall.Listener.

4. Client-side end time: in ClientStreamListener.closed(), but before
calling onClonse() on ClientCall.Listener

Message sizes are recorded in MessageFramer and MessageDeframer. Both
the uncompressed and wire (possibly compressed) payload sizes are
counted.

TODOs
=====

The CensusContext created from headers on the server side should be
attached to the gRPC Context for the call.  It's not done at this moment
because Census lacks the proper API to do it. It only affects tracing
and resource accounting, but doesn't affect stats functionality
2016-10-06 17:15:24 -07:00
dapengzhang0 4e5765a93f all: fix minor JavaStyle errors found in code sync 2016-10-05 09:28:16 -07:00
Eric Anderson cad7124c27 core,netty: split stream state on client-side; AbstractStream2
OkHttp will need to be migrated in a future commit.
2016-10-03 11:10:38 -07:00
Jakob Buchgraber 7aa0e1a901 netty: server support extension content types (#2306)
Removed a (left over?) content type check that checks for equality with "application/grpc".
The content type is verified using checkContentType(..).
2016-09-30 10:05:21 +02:00
Carl Mastrangelo 34812835a8 interop-testing: limit the amount of noise from failing tests
Also mark Netty class as internal
2016-09-28 17:09:39 -07:00
Carl Mastrangelo f5f9ca52c8 all: fix minor bugs discovered on import 2016-09-28 14:35:51 -07:00
Łukasz Strzałkowski ce78224e0b netty: Refactor passing down SSL Session (#2295)
Create generic interface for handling passing down arbitrary attributes from
protocol negotiation handlers.

Addresses #1556.
2016-09-23 19:04:53 -07:00
Carl Mastrangelo 141eed5ed0 core: change Metadata internals to avoid garbage creation
Before:
Benchmark                                                                   (headerCount)    Mode     Cnt        Score    Error  Units
InboundHeadersBenchmark.defaultHeaders_clientHandler                                  N/A    avgt      10      240.879 ±  4.903  ns/op
InboundHeadersBenchmark.defaultHeaders_serverHandler                                  N/A    avgt      10      882.354 ± 16.177  ns/op
InboundHeadersBenchmark.grpcHeaders_clientHandler                                     N/A    avgt      10      208.068 ±  5.380  ns/op
InboundHeadersBenchmark.grpcHeaders_serverHandler                                     N/A    avgt      10      477.604 ±  8.200  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                           1  sample  234233      125.232 ± 11.903  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                           5  sample  344367      264.343 ± 18.318  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                          10  sample  392273      439.640 ±  2.589  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                          20  sample  221506      855.115 ± 38.899  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                           1  sample  253676      111.941 ±  2.742  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                           5  sample  368499      248.255 ±  2.601  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                          10  sample  390015      439.651 ± 11.040  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                          20  sample  221807      840.435 ± 21.667  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                            1  sample  230139      432.866 ± 25.503  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                            5  sample  226901      765.095 ± 19.969  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                           10  sample  260495     1268.239 ± 21.850  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                           20  sample  311526     2059.973 ± 23.503  ns/op

After:

Benchmark                                                                   (headerCount)    Mode     Cnt        Score    Error  Units
InboundHeadersBenchmark.defaultHeaders_clientHandler                                  N/A    avgt      10      104.317 ±  1.973  ns/op
InboundHeadersBenchmark.defaultHeaders_serverHandler                                  N/A    avgt      10      395.666 ± 11.056  ns/op
InboundHeadersBenchmark.grpcHeaders_clientHandler                                     N/A    avgt      10       64.147 ±  4.076  ns/op
InboundHeadersBenchmark.grpcHeaders_serverHandler                                     N/A    avgt      10      228.299 ±  2.874  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                           1  sample  252451      102.718 ±  2.714  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                           5  sample  239976      225.812 ± 38.824  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                          10  sample  258119      364.475 ± 57.217  ns/op
OutboundHeadersBenchmark.convertClientHeaders                                          20  sample  260138      676.950 ± 36.243  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                           1  sample  276064      105.371 ±  1.859  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                           5  sample  255128      190.970 ± 16.475  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                          10  sample  272923      366.769 ± 28.204  ns/op
OutboundHeadersBenchmark.convertServerHeaders                                          20  sample  264797      641.961 ± 18.879  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                            1  sample  226078      425.262 ±  3.481  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                            5  sample  253606      675.488 ± 26.001  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                           10  sample  286556     1157.014 ± 12.923  ns/op
OutboundHeadersBenchmark.encodeClientHeaders                                           20  sample  345649     1874.806 ± 36.227  ns/op
2016-09-19 14:25:48 -07:00
Jakob Buchgraber af2434375a netty: complete promise when RequestMessagesCommand 2016-09-13 21:41:56 +02:00
Jakob Buchgraber 4aadf550ee netty: Fix receipt of ClosedChannelException instead of actual error. Fixes #1330.
Our API allows pings to be send even after the transport has been shutdown. We currently
don't handle the case, where the Netty channel has been closed but the NettyClientHandler
has not yet been removed from the pipeline, correctly. That is, we need to query the shutdown
status whenever we receive a ClosedChannelException.

Also, some cleanup.
2016-09-12 19:17:34 +02:00
Jakob Buchgraber 8c18a0d355 netty: use custom http2 headers for decoding.
The DefaultHttp2Headers class is a general-purpose Http2Headers implementation
and provides much more functionality than we need in gRPC. In gRPC, when reading
headers off the wire, we only inspect a handful of them, before converting to
Metadata.

This commit introduces a Http2Headers implementation that aims for insertion
efficiency, a low memory footprint and fast conversion to Metadata.

  - Header names and values are stored in plain byte[].
  - Insertion is O(1), while lookup is now O(n).
  - Binary header values are base64 decoded as they are inserted.
  - The byte[][] returned by namesAndValues() can directly be used to construct
    a new Metadata object.
  - For HTTP/2 request headers, the pseudo headers are no longer carried over to
    Metadata.

A microbenchmark aiming to replicate the usage of Http2Headers in NettyClientHandler
and NettyServerHandler shows decent throughput gains when compared to DefaultHttp2Headers.

Benchmark                                             Mode  Cnt     Score    Error  Units
InboundHeadersBenchmark.defaultHeaders_clientHandler  avgt   10   283.830 ±  4.063  ns/op
InboundHeadersBenchmark.defaultHeaders_serverHandler  avgt   10  1179.975 ± 21.810  ns/op
InboundHeadersBenchmark.grpcHeaders_clientHandler     avgt   10   190.108 ±  3.510  ns/op
InboundHeadersBenchmark.grpcHeaders_serverHandler     avgt   10   561.426 ±  9.079  ns/op

Additionally, the memory footprint is reduced by more than 50%!

gRPC Request Headers: 864 bytes
Netty Request Headers: 1728 bytes
gRPC Response Headers: 216 bytes
Netty Response Headers: 528 bytes

Furthermore, this change does most of the gRPC groundwork necessary to be able
to cache higher ordered objects in HPACK's dynamic table, as discussed in [1].

[1] https://github.com/grpc/grpc-java/issues/2217
2016-09-09 23:15:18 +02:00
Carl Mastrangelo 35c3f8171b core/internal: replace make Stream id a primitive 2016-09-08 17:39:51 -07:00
Carl Mastrangelo f78644d762 core: add Metadata.discardAll()
Metadata.removeAll creates an iterator for looking through removed
values even if the call doens't use it.  This change adds a similar
method which doesn't create garbage.

This change makes it easier in the future to alter the internals
of Metadata where it may be expensive to return removed values.
2016-09-08 10:29:22 -07:00
Carl Mastrangelo ca5a402fe6 netty: cache method path conversion
Benchmark                                      Mode      Cnt   Score   Error  Units
MethodDescriptorBenchmark.direct             sample  1179094  43.483 ± 0.610  ns/op
MethodDescriptorBenchmark.old                sample  1079285  66.210 ± 5.402  ns/op
MethodDescriptorBenchmark.transportSpecific  sample  1408070  36.800 ± 0.423  ns/op
2016-09-07 14:41:02 -07:00
Kun Zhang 58d78dd0aa core: add ServerTransportFilter
Called whenever a ServerTransport is ready and terminated.  Has the
ability to modify transport attributes, which ServerCall.attributes()
are based on.

Related changes:

- Attribute keys for remote address and SSL session are now moved from
ServerCall to a neutral place io.grpc.Grpc, because they can also be
used from ServerTransportFilter, and probably will be used on the
client-side too.  The old keys on ServerCall is marked deprecated and
are equivalent to the new keys.
- Added transportReady() to ServerTransportListener.

Resolves #2132
2016-08-31 14:45:15 -07:00
mfcripps 8a0c89a9f8 integration-tests: add integration tests for auto window sizing 2016-08-19 15:55:39 -07:00
mfcripps 9ef13a4725 netty: add window resizing to netty handlers and unit tests 2016-08-17 16:21:30 -07:00
Carl Mastrangelo 1285477133 all: add parameter name to checkNotNull
After debugging #2153, it would have been nice to know what the exact
parameter was that was null. This change adds a name for each
checkNotNull (and tries to normalized on static imports in order to
shorten lines)
2016-08-12 14:55:00 -07:00
Eric Anderson 7d464fcb02 inprocess: Avoid creating unnecessary threads
Implementations of ManagedClientTransport.start() are restricted from
calling the passed listener until start() returns, in order to avoid
reentrency problems with locks. For most transports this isn't a
problem, because they need additional threads anyway. InProcess uses no
additional threads naturally so ends up needing a thread just to
notifyReady. Now transports can just return a Runnable that can be run
after locks are dropped.

This was originally intended to be a performance optimization, but the
thread also causes nondeterminism because RPCs are delayed until
notifyReady is called. So avoiding the thread reduces needless fakes
during tests.
2016-08-02 13:16:36 -07:00
Eric Anderson e23d7ec08a netty: Add test for AbstractHttp2Headers
This increases line coverage by 1.3%.
2016-07-20 16:54:35 -07:00
Eric Anderson 4289aaf79c core: Hard-code a list of providers for Android
Class.getResource() is expensive on Android, which is used by
ServiceLoader. So we hard-code a list for Android instead.

Fixes #2037
2016-07-20 09:49:59 -07:00
Carl Mastrangelo 297af4425e netty: always flush at least once, even if there were no writes 2016-07-19 11:18:54 -07:00
Carl Mastrangelo 953599543e netty: reduce contention in WriteQueue
WriteQueue uses LinkedBlockingQueue, which has stronger synchronization
semantics than we need.  It also requires that we batch reads from it
in order to get reasonable performance.  After profiling the delay
between writing to LBQ and reading from it, there was a ~10us delay.

This change switches to using ConcurrentLinkedQueue as the underlying
queue, and removes the batching (reads).  Using CLQ with batching is
slightly slower.

Benchmarks show favorable numbers for both latency and throughput.
Each of the following results were run serveral times:

Before:
Benchmark                         (direct)  (transport)    Mode     Cnt       Score     Error  Units
TransportBenchmark.unaryCall1024      true        NETTY  sample  321575  124185.027 ± 406.112  ns/op
TransportBenchmark.unaryCall1024     false        NETTY  sample  237400  168232.991 ± 548.043  ns/op

After:
Benchmark                         (direct)  (transport)    Mode     Cnt       Score     Error  Units
TransportBenchmark.unaryCall1024      true        NETTY  sample  354773  112552.339 ± 362.471  ns/op
TransportBenchmark.unaryCall1024     false        NETTY  sample  263297  151660.490 ± 507.463  ns/op

Qps with 10 outstanding RPCs per channel:

Before:
Channels:                       4
Outstanding RPCs per Channel:   10
Server Payload Size:            0
Client Payload Size:            0
50%ile Latency (in micros):     396
90%ile Latency (in micros):     680
95%ile Latency (in micros):     838
99%ile Latency (in micros):     1476
99.9%ile Latency (in micros):   5231
Maximum Latency (in micros):    43327
QPS:                            85761

After:
Channels:                       4
Outstanding RPCs per Channel:   10
Server Payload Size:            0
Client Payload Size:            0
50%ile Latency (in micros):     384
90%ile Latency (in micros):     612
95%ile Latency (in micros):     725
99%ile Latency (in micros):     1080
99.9%ile Latency (in micros):   3107
Maximum Latency (in micros):    30447
QPS:                            93353

The results are even better when under heavy load.  Qps with 100
outstanding RPCs per channel:

Before:
Channels:                       4
Outstanding RPCs per Channel:   100
Server Payload Size:            0
Client Payload Size:            0
50%ile Latency (in micros):     2735
90%ile Latency (in micros):     5051
95%ile Latency (in micros):     6219
99%ile Latency (in micros):     9271
99.9%ile Latency (in micros):   13759
Maximum Latency (in micros):    44831
QPS:                            125775

After:
Channels:                       4
Outstanding RPCs per Channel:   100
Server Payload Size:            0
Client Payload Size:            0
50%ile Latency (in micros):     2697
90%ile Latency (in micros):     4639
95%ile Latency (in micros):     5539
99%ile Latency (in micros):     7931
99.9%ile Latency (in micros):   12335
Maximum Latency (in micros):    61823
QPS:                            131904
2016-07-18 09:50:47 -07:00
Jakob Buchgraber edf2c62fd5 netty: update to 4.1.2.Final and tcnative Fork18 2016-07-12 08:06:19 +02:00
Jakob Buchgraber 0d6a9de54c netty: deduplicate javadoc accidentially introduced in e80b136495 2016-07-10 09:51:16 +02:00
Jakob Buchgraber e80b136495 Fix wrong use of checkNotNull in WriteQueue.
* Fix wrong use of checkNotNull in WriteQueue.

The issue was found and reported by @blakearnold. Thank you!
2016-07-08 16:00:34 +02:00
Eric Anderson 16b096b571 Reduce default max message size to 4 MiB
Fixes #1676
2016-07-07 13:34:53 -07:00
Jakob Buchgraber 2d7347fbfc netty: undo commit 6a55e29 as netty's DefaultThreadFactory has been fixed 2016-07-02 13:23:41 +02:00
Jakob Buchgraber 1257f96a00 netty: reduce allocations in write queue.
- Merge all the command objects with QueuedCommand so to save one object allocation per write.
- Add unit tests
2016-07-02 12:17:54 +02:00
Carl Mastrangelo 2292cbfca0 netty: prevent race between transportCreated and transportShutdown 2016-07-01 15:57:47 -07:00
Jakob Buchgraber c5733742ce netty: fix incorrect usage of AsciString.
An AsciiString object may only use a subsection of its backing byte array. We need to test for this and return a copy of the subsection if necessary.
Big thanks to @normanmaurer for uncovering this issue: https://github.com/netty/netty/issues/5472
2016-06-30 16:28:45 +02:00
ZHANG Dapeng 8ed2dc8bec testware: fix flakes caused by pickUnusedPort
Resolves #1756

The thread-unsafe method `io.grpc.testing.TestUtils.pickUnusedPort` causes flakes (#1756) in windows. Need to avoid use of this method in test as in windows the tests are running in different jvms and concurrent calls of this method in multiple processes tend to return the same port number.

There are some usages of this method in benchmarks, so moved the method to `io.grpc.benchmarks.Utils` and the method will only be used in benchmarks and not in test.
2016-06-28 13:34:38 -07:00
Jakob Buchgraber fc5197fbf4 netty: detect when ALPN was not used. Fixes #522 2016-06-25 15:59:30 +02:00
Kun Zhang 38b950f4f9 core: add transportInUse() to transport listener.
A transport is "in use" iff number of streams > 0. In following changes
the channel will use this information when deciding whether it should
transit to the IDLE mode (#1276).
2016-06-15 13:40:44 -07:00
Kun Zhang 432cec7973 core: CallCredentials
Introduce CallCredentials as a first-class option to allow applications
to set per-call credentials into headers for outgoing RPCs. This will
supersede ClientAuthInterceptor. It has access to more
information (e.g., transport attributes, MethodDescriptor) and allow
results to be returned asynchronously, e.g., from a blocking I/O, which
was problemantic with ClientAuthInterceptor.
2016-06-09 17:46:15 -07:00
ZHANG Dapeng b88ea27b53 core/internal: add 3-arg newStream method to ClientTransport interface (#1898)
adding 
ClientStream newStream(MethodDescriptor<?, ?> method, Metadata headers, CallOptions callOptions);
to ClientTransport interface

Created this PR first because both fail fast implementation and another change will be using this interface change
2016-06-06 19:43:15 -07:00
Eric Anderson c6fd94ca85 Implement shutdownNow
Fixes #448
2016-06-02 17:39:59 -07:00
Jakob Buchgraber c6c74799f4 netty: add toString() to GrpcHttp2Headers 2016-06-02 18:18:55 +02:00
Carl Mastrangelo 676bf4854f core: fix nags from linter 2016-06-01 13:58:07 -07:00
Carl Mastrangelo 02eb24b3bd core,netty,okhttp: move user agent removal closer to where it is set 2016-06-01 12:55:21 -07:00
Carl Mastrangelo fa22259e3a netty: use custom Http2Headers class for encoding Metadata
Before:
Benchmark                              (headerCount)    Mode     Cnt     Score    Error  Units
HeadersBenchmark.convertClientHeaders             10  sample  127008   631.214 ±  3.543  ns/op
HeadersBenchmark.convertClientHeaders             20  sample  142036  1125.874 ± 21.114  ns/op
HeadersBenchmark.convertClientHeaders             50  sample  117570  2678.635 ± 47.764  ns/op
HeadersBenchmark.convertClientHeaders            100  sample  115919  5427.720 ± 67.956  ns/op
HeadersBenchmark.convertServerHeaders             10  sample  133903   610.970 ±  3.094  ns/op
HeadersBenchmark.convertServerHeaders             20  sample  138155  1154.304 ±  4.595  ns/op
HeadersBenchmark.convertServerHeaders             50  sample  120078  2658.175 ± 38.679  ns/op
HeadersBenchmark.convertServerHeaders            100  sample  120509  5212.341 ± 49.062  ns/op

After:
Benchmark                              (headerCount)    Mode     Cnt     Score    Error  Units
HeadersBenchmark.convertClientHeaders             10  sample  102473   407.383 ±  2.693  ns/op
HeadersBenchmark.convertClientHeaders             20  sample  103205   791.241 ± 38.054  ns/op
HeadersBenchmark.convertClientHeaders             50  sample  173817  1840.311 ±  5.718  ns/op
HeadersBenchmark.convertClientHeaders            100  sample  169984  3690.753 ± 44.308  ns/op
HeadersBenchmark.convertServerHeaders             10  sample  103615   401.661 ±  2.922  ns/op
HeadersBenchmark.convertServerHeaders             20  sample   99060   823.453 ±  5.553  ns/op
HeadersBenchmark.convertServerHeaders             50  sample  171824  1846.788 ± 29.840  ns/op
HeadersBenchmark.convertServerHeaders            100  sample  171622  3670.354 ±  7.127  ns/op
2016-05-25 17:23:51 -07:00
Carl Mastrangelo 1cc76d8132 core,netty,okhttp: move user agent out of client call and into the transport 2016-05-25 15:11:42 -07:00
Carl Mastrangelo 5e30b2f7ba netty: speed up header conversion by caching user agent string
Performance gain seems to be about 100-200ns based on a a couple trials.

Benchmark                                 (headerCount)  (validate)    Mode     Cnt     Score    Error  Units
HeadersBenchmark.convertClientHeadersOld             10       false  sample  187490   858.234 ±  3.992  ns/op
HeadersBenchmark.convertClientHeadersOld             20       false  sample  113589  1407.557 ± 45.178  ns/op
HeadersBenchmark.convertClientHeadersOld             50       false  sample  100725  3141.936 ± 55.175  ns/op
HeadersBenchmark.convertClientHeadersOld            100       false  sample  109742  5707.748 ± 38.222  ns/op
HeadersBenchmark.convertHeaders                      10       false  sample  109137   748.486 ±  4.060  ns/op
HeadersBenchmark.convertHeaders                      20       false  sample  133639  1238.528 ± 51.914  ns/op
HeadersBenchmark.convertHeaders                      50       false  sample  107914  2915.602 ± 10.017  ns/op
HeadersBenchmark.convertHeaders                     100       false  sample  110305  5682.404 ± 44.032  ns/op
2016-05-23 17:49:30 -07:00
Eric Anderson 39d1e31547 netty: Fix test to support netty 4.1.0.Final 2016-05-23 13:22:18 -07:00
Eric Anderson 6382015f9d internal: Split-state AbstractStream; sending and receiving
This introduces an AbstractStream2 that is intended to replace the
current AbstractStream. Only server-side is implemented in this commit
which is why AbstractStream remains. This is mostly a reorganization of
AbstractStream and children, but minor internal behavioral changes were
required which makes it appear more like a reimplementation.

A strong focus was on splitting state that is maintained on the
application's thread (with Stream) and state that is maintained by the
transport (and used for StreamListener). By splitting the state it makes
it much easier to verify thread-safety and to reason about interactions.

I consider this a stepping stone for making even more changes to
simplify the Stream implementations and do not think some of the changes
are yet at their logical conclusion. Some of the changes may also
immediately be replaced with something better. The focus was to improve
readability and comprehesibility to more easily make more interesting
changes.

The only thing really removed is some state checking during sending
which is already occurring in ServerCallImpl.
2016-05-23 12:33:49 -07:00
Carl Mastrangelo 8090effa2d netty: don't revalidate when converting between Metadata and Http2Headers 2016-05-23 11:02:22 -07:00
Eric Anderson 27dffdfe03 netty: call transportShutdown immediately on ID exhaustion
Fixes #1819
2016-05-13 13:39:47 -07:00
Kun Zhang 95973827f5 Refactor HandlerRegistry.
See #933

- Create InternalHandlerRegistry, an immutable look-up table. Handlers
  passed to ServerBuilder.addService() go to this registry. This covers
  the most common use cases. By keeping the registry internal we could
  freely change the registry's interface to accommodate optimizations,
  e.g., for hpack.

- The internal registry uses a flat fullMethodName -> handler look-up
  table instead of a hierarchical one used before. It faster because it
  saves one look-up and a substring.

- Introduces the fallback registry, settable by
  ServerBuilder.fallbackHandlerRegistry(), for advanced users who want a
  dynamic registry. Moved the current MutableHandlerRegistryImpl to
  io.grpc.util.MutableHandlerRegistry as a stock implementation of the
  fallback registry. The io.grpc.MutableHandlerRegistry interface is now
  removed.
2016-05-04 17:12:32 -07:00
Carl Mastrangelo bc661e7fbb all: Finish adding tracking issues for ExperimentalApi 2016-05-03 16:15:57 -07:00
Carl Mastrangelo c6faf3541b Add a log message for unknown client streams 2016-05-02 14:04:19 -07:00
ZHANG Dapeng aed886d8de use Jetty ALPN agent instead of Jetty ALPN
#1497
2016-05-02 14:01:36 -07:00
Eric Anderson 80baa631a7 Use return value of Status.augmentDescription 2016-05-01 08:11:45 -07:00
ZHANG Dapeng 804991e80d validate sslContext in Netty channel/server builder #1699 (#1724)
validate sslContext in Netty channel/server builder #1699

resolves #1699
2016-04-27 13:02:43 -07:00
Carl Mastrangelo 38a91f83e1 Fix lint warnings found on internal import 2016-04-26 13:21:25 -07:00
Carl Mastrangelo 00f8f349b2 Don't allocate extra byte for each MessageFramer 2016-04-21 10:48:53 -07:00
Carl Mastrangelo d0d946ec9f new name 2016-04-18 16:21:53 -07:00
Carl Mastrangelo c4e8b1f10f Rename internal.Server to internal.TransportServer 2016-04-18 15:50:20 -07:00
Eric Anderson 6ab27aba13 Update checkstyle version and sync style updates 2016-04-18 09:15:25 -07:00
Carl Mastrangelo 51fd870cfd Add getting the port out of a Server 2016-04-13 13:54:45 -07:00
nmittler 22e719a5f9 Convert Netty IOExceptions to UNAVAILABLE.
Also inspecting the entire causal chain to identify the best possible Status.

Fixes #1053
Fixes #1522
2016-04-13 11:47:58 -07:00
Carl Mastrangelo 0ed059a408 Add rst error detail in OkHttp 2016-04-08 13:19:14 -07:00
Carl Mastrangelo 7d889b6911 Reuse metadata array when making http2 headers, and reduce some array copies 2016-04-08 13:08:07 -07:00
Kun Zhang 6a55e2990b Force thread group on threads created by Netty's DefaultThreadFactory.
As a workaround for https://github.com/netty/netty/issues/5084
2016-04-06 14:30:21 -07:00
Eric Anderson 2a5a41b600 Fix UNAVAILABLE codes missing descriptions
All status codes we generate from the library should have more
information available, either in the description or as a cause.
2016-03-31 09:51:33 -07:00
Kun Zhang 49b462784f Raise visibility of NettyTransportFactory to protected.
It's needed by internal code.
2016-03-29 12:06:18 -07:00
Carl Mastrangelo 65d3847d14 Remove references to Throwable.propagate 2016-03-22 15:47:52 -07:00
Lukasz Strzalkowski c3011b0798 Move server call keys to ServerCall class 2016-03-17 19:46:26 -04:00
buchgr d927180a63 Use Netty's DefaultThreadFactory instead of Guava's ThreadFactoryBuilder.
So far, we have passed a custom Executor to the NioEventLoopGroup constructor,
in order to get custom thread names and be compatible with both Netty 4 and
Netty 5. However, Netty 5 is no more (RIP) and Netty's DefaultThreadFactory
includes some optimizations around thread local storage, that Guava's executor
does not have.

The thread names will be a bit different, as DefaultThreadExecutor additionally
puts in the thread pool id after the name prefix.

For example:

Before:
grpc-default-boss-ELG-0
grpc-default-worker-ELG-0
grpc-default-worker-ELG-1

After:
grpc-default-boss-ELG-0-0
grpc-default-worker-ELG-1-0
grpc-default-worker-ELG-1-1
2016-03-17 00:43:26 +01:00
buchgr 3c68c053f7 Remove ReferenceCounted and add close() to ClientTransportFactory. Fixes #927 2016-03-17 00:31:04 +01:00
Lukasz Strzalkowski 6a67a97a73 Add attributes to ServerCall 2016-03-16 15:39:42 -07:00
Kun Zhang b9c12327eb Add log ID.
To ManagedChannelImpl, TransportSet and all client transport
implementations, so they can be correlated in the logs. Also added more
life-cycle logging in general.
2016-03-09 13:52:32 -08:00