Commit Graph

1382 Commits

Author SHA1 Message Date
Kun Zhang c08d74fec4 TransportSet shutdown() also shuts down the pending transport.
Previously TransportSet.shutdown() only shuts down the active transport,
which means a transport will not be shutdown if it's not ready yet. This
issue was introduced by #1494 that postponed the assignment of the
active transport till transport ready.
2016-05-29 15:45:03 -07:00
Carl Mastrangelo 9f37951680 benchmarks: honor transport in AsyncClient 2016-05-27 11:55:18 -07:00
ZHANG Dapeng 361936401f core/internal: fix regex pattern 2016-05-26 14:02:15 -07:00
Eric Anderson 7052d8b5e9 core: Promote Deadline API to stable
Fixes #1706
2016-05-26 13:33:48 -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
Eric Anderson 149ce204e2 netty: Bump netty dep to 4.1.0.Final
Is such a thing even possible? Yes it is.

Note that HTTP/2 in Netty still is not stable, so we remain
version-pinned.
2016-05-25 16:58:51 -07:00
Carl Mastrangelo ca8e166591 okhttp: generate user agent once for whole transport 2016-05-25 16:37:54 -07:00
Carl Mastrangelo f172170649 benchmarks: use more realistic header counts in benchmark 2016-05-25 16:30:29 -07:00
Carl Mastrangelo 4204eb8cd9 core: allocate less garbage iterators in Metadata.serialize
Before:
HeadersBenchmark.convertClientHeaders             10  sample   99004   806.749 ±   4.692  ns/op
HeadersBenchmark.convertClientHeaders             20  sample  105673  1540.814 ±  86.361  ns/op
HeadersBenchmark.convertClientHeaders             50  sample  188978  3347.881 ±  71.778  ns/op
HeadersBenchmark.convertClientHeaders            100  sample  189913  6626.884 ±  94.348  ns/op
HeadersBenchmark.convertServerHeaders             10  sample  107884   766.328 ±  49.338  ns/op
HeadersBenchmark.convertServerHeaders             20  sample  122568  1303.501 ±   8.820  ns/op
HeadersBenchmark.convertServerHeaders             50  sample  109281  2920.586 ±  93.654  ns/op
HeadersBenchmark.convertServerHeaders            100  sample  196784  6429.566 ± 108.588  ns/op

After:
HeadersBenchmark.convertClientHeaders             10  sample  113274   715.382 ±  5.412  ns/op
HeadersBenchmark.convertClientHeaders             20  sample  128654  1294.677 ± 67.867  ns/op
HeadersBenchmark.convertClientHeaders             50  sample  112598  2814.925 ± 62.291  ns/op
HeadersBenchmark.convertClientHeaders            100  sample  116920  5383.146 ± 90.205  ns/op
HeadersBenchmark.convertServerHeaders             10  sample  130004   626.243 ±  3.528  ns/op
HeadersBenchmark.convertServerHeaders             20  sample  142054  1185.193 ± 80.272  ns/op
HeadersBenchmark.convertServerHeaders             50  sample  115153  2795.715 ± 92.956  ns/op
HeadersBenchmark.convertServerHeaders            100  sample  119520  5249.636 ± 56.089  ns/op
2016-05-25 15:12:40 -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
nmittler c102dd4e4f Add trailers to Status for BlockingResponseStream
Fixes #1861
2016-05-25 12:04:55 -07:00
nmittler 6e40edbc21 Add trailers to Status for BlockingResponseStream 2016-05-25 06:54:31 -07:00
Eric Anderson 641cb357c6 Tweak -Xlint warnings
This now catches a few more places we needed -Xlint:-options.
InProcessSocketAddress is technically already in our stable API, so I
maintained its current serialVersionUID.
2016-05-24 15:04:07 -07:00
Eric Anderson e4ea237597 core: Refactor TransportSet in prep for fail fast
This is functionally equivalent. Some tests needed changes because they
were verifying internal behavior.
2016-05-24 14:40:07 -07:00
Carl Mastrangelo cca473df99 benchmarks: add client/server header benchmarks 2016-05-24 13:11:14 -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
Łukasz Strzałkowski ac9a5a5679 Make Code.status() public, add Status#fromCode()
Closes #1722
2016-05-23 17:03:48 -07:00
Eric Anderson 8033cdd3a7 core: Add unit test for Contexts.interceptCall 2016-05-23 13:51:10 -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
ZHANG Dapeng b7eea7c13a implements health check service
resolves #647
2016-05-20 14:03:29 -07:00
Eric Anderson 65dd5db5e3 protolite: Use 'unused' variable to avoid CheckReturnValue
Internally toByteArray is annotated with CheckReturnValue, which can
cause a failure during compilation if the value is ignored.
2016-05-20 09:46:46 -07:00
Eric Anderson aa92d6c643 build: Update jetty for JDK 8u92 2016-05-19 11:43:48 -07:00
Carl Mastrangelo 8c7440e141 benchmarks: add NETTY_EPOLL as an option for transport testing 2016-05-18 16:37:42 -07:00
Carl Mastrangelo e19848092d core, interop-testing: always set message encoding, and use it in interop tests
This change updates the behavior of the core compression semantics.  Previously,
if the codec was "identity", nothing was set on the wire.  This is allowed by
the spec, but doesn't match what wrapped languages do.

Additionally, the interop tests will now attempt to honor the requested
compression.
2016-05-18 12:04:25 -07:00
Carl Mastrangelo 6a802a2027 benchmarks: revert use of CMS GC 2016-05-17 10:38:59 -07:00
Carl Mastrangelo d08c167bc7 benchmarks: use Concurrent Mark and Sweep GC for benchmark worker 2016-05-16 16:44:58 -07:00
Eric Anderson 5a2e5e16a2 android-interop-test: Enable checkstyle; fix violations 2016-05-16 12:44:15 -07:00
Carl Mastrangelo 2825361767 stub: use correct javadoc link for Guava 2016-05-16 10:25:03 -07:00
Eric Anderson a70e1a4d8b interop: Don't catch AssertionError as it makes test failure confusing 2016-05-16 09:52:48 -07:00
Eric Anderson 13fe13bf9f okhttp: Enable transport test
OkHttpClientTransport has a fix for shutdown during start which
prevented transportTerminated from being called. It also no longer fails
pending streams during shutdown. Lifecycle management in general was
revamped to be hopefully simpler and more precise. In the process GOAWAY
handling (both sending and receiving) was improved.

With some of the changes, the log spam generated was immense and
unhelpful (since many exceptions are part of normal operation on
shutdown). This change reduces the amount of log spam to nothing.
2016-05-16 09:52:48 -07:00
Carl Mastrangelo 188840b920 benchmarks: update to JMH 1.12 2016-05-13 21:25:31 -07:00
Carl Mastrangelo 4e268da29b core: Don't lose server call exception when message fails to close 2016-05-13 15:59:06 -07:00
nmittler 951b5a4ca2 Adding metadata to Status exceptions.
Fixes #681
2016-05-13 15:52:06 -07:00
Eric Anderson 27dffdfe03 netty: call transportShutdown immediately on ID exhaustion
Fixes #1819
2016-05-13 13:39:47 -07:00
Jakob Buchgraber ce002bd449 core: allow ClientCall.cancel before start. Fixes #1536 (#1822) 2016-05-13 22:20:02 +02:00
Carl Mastrangelo f13fbaa782 interop-testing: update testing protos to include compression fields 2016-05-13 11:00:33 -07:00
Jakob Buchgraber 46edcad0c1 Don't enforce a timeout in stress test client. Fixes #1812 (#1823) 2016-05-13 19:18:13 +02:00
Eric Anderson 4e8cf923ca docs: Don't suggest downloading grpc-all
grpc-all is now just a husk of a JAR. Instead, users will need to
download each JAR they need separately.

Fixes #1805
2016-05-12 13:00:47 -07:00
Carl Mastrangelo f85ecdfbc4 interop-testing: Print JVM Flags by default for Stress tests 2016-05-11 13:20:23 -07:00
nmittler d9d4d8b70f Updating status codes to match the spec.
Fixes #1605
2016-05-09 13:55:50 -07:00
Eric Anderson 446f0cb85f Upgrade to Gradle 2.13
This improves our documentation for the gradle protobuf plugin, as its
version is dependent on the gradle version.

Gradle now has the --tests flag, performance improvements, and support
for OpenPGP subkeys.
2016-05-09 09:36:13 -07:00
Eric Anderson 83bf5e6f42 Fix flakiness of testConfigureDeadlineNanoTime with warmup
Without the warm up I saw large deltas, like 2,262,968ns and
1,712,558ns, on my machine. With the single-line warm up the deltas
decreased dramitically, like 385ns and 536ns. Since our times are so
much better now, decreasing the required delta to 10ms seems reasonable.

This would seem to support the theory that the flakiness was caused by
the class loader, which may even be doing I/O.

Fixes #1646
2016-05-06 09:41:46 -07:00
Kun Zhang 91b087e526 Remove an obsolete comment on ServerServiceDefinition.
Commit 9597382 introduced InternalHandlerRegistry as the main registry,
which uses a flat map from fullMethodNames to handlers, thus addressed
the original intention of this comment.
2016-05-05 09:25:04 -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 dc80b52da6 context: Remove tests for Key Equality. 2016-05-04 16:39:55 -07:00
Carl Mastrangelo bc661e7fbb all: Finish adding tracking issues for ExperimentalApi 2016-05-03 16:15:57 -07:00
Eric Anderson 1d7a11ca24 travis: Avoid $HOME in cache, since it varies
$HOME can be different between different platforms/configurations, so
using /tmp means the path is consistent and be shared in the caches.
2016-05-03 16:09:47 -07:00
Carl Mastrangelo 0f9e3fa2ea all: Add issues for many of the experimental API annotations 2016-05-03 13:24:28 -07:00