Commit Graph

90 Commits

Author SHA1 Message Date
Eric Anderson 4168f67e38 Optimize blocking calls to avoid app thread pool
This reduces the necessary number of threads in the application executor
and provides a small improvement in latency (~15μs, which is normally in
the noise, but would be a 5% improvement).

Benchmark                         (direct)  (transport)  Mode  Cnt       Score        Error  Units
Before:
TransportBenchmark.unaryCall1024      true    INPROCESS  avgt   10    1566.168 ±     13.677  ns/op
TransportBenchmark.unaryCall1024     false    INPROCESS  avgt   10   35769.532 ±   2358.967  ns/op
After:
TransportBenchmark.unaryCall1024      true    INPROCESS  avgt   10    1813.778 ±     19.995  ns/op
TransportBenchmark.unaryCall1024     false    INPROCESS  avgt   10   18568.223 ±   1679.306  ns/op

The benchmark results are exactly what we would expect, assuming that
half of the benefit of direct is on server and half on client:
1566 + (35769 - 1566) / 2 = 18668 ns --vs-- 18568 ns

It is expected that direct=true would get worse, because
SerializingExecutor is now used instead of
SerializeReentrantCallsDirectExecutor plus the additional cost of
ThreadlessExecutor.

In the future we could try to detect the ThreadlessExecutor and ellide
Serializ*Executor completely (as is possible for any single-threaded
executor). We could also optimize the queue used in ThreadlessExecutor
to be single-producer, single-consumer. I don't expect to do those
optimizations soon, however.
2016-01-26 12:41:50 -08:00
Eric Anderson fe5e624153 Avoid cancel before start, which is not handled in transports
When triggered, it caused the ClientCall.Listener never to complete.
Fixes #1343

The new test doesn't actually fail on my machine with the old code, but
we would hope it would be flaky. Since a race is involved, I don't
expect a more reliable test.
2016-01-25 13:20:10 -08:00
Eric Anderson 15d86d9c42 Parameterize TlsTest for TLS provider 2016-01-25 13:17:19 -08:00
Eric Anderson 0a2a4ec4d2 Move resource freeing out of test methods
This avoids the try-finally, which would have gotten even larger to
shutdown the channels.
2016-01-25 13:17:19 -08:00
Eric Anderson 4aee912bce Fix broken noClientAuthFailure test
The client didn't have the trust manager set, so the RPC would fail due
to server-certificate verification, not lack of client auth.

With this change, noClientAuthFailure now fails with tcnative but still
passes with Jetty ALPN.

basicClientServerIntegrationTest seems to be working for me, so I'm
enabling it.
2016-01-22 12:59:36 -08:00
Eric Anderson cfbd7efcf0 Use tcnative for interop unit tests when possible.
We are already building a new enough OpenSSL on Travis for both Linux
and OS X and Jenkins for Windows.
2016-01-21 16:40:29 -08:00
Matt Hildebrand 95d7bfd2b9 Add some initial integration tests for GRPC's TLS support.
Tests run using Jetty ALPN only, not using OpenSSL.
2016-01-21 13:46:19 -08:00
Eric Anderson d52429dffd Reduce number of codegen'd classes needed for Services
This reduces the number of classes defined, which reduces memory usage.
It also reduces the number of methods defined, which is important
because of the dex limit.

This should have virtually zero performance degradation because the
contiguous switch uses tableswitch bytecode.
2016-01-15 16:45:41 -08:00
Eric Anderson 218865a19e Revert "More information for debugging."
This reverts commit eca1f7c1d6.

We want to preserve the status message identical to what the server
sent. We'll need a better way to communicate debugging details.
2016-01-11 16:35:43 -08:00
Kun Zhang eca1f7c1d6 More information for debugging.
- Include transport information in RPC's final status
- Implement toString() of transports
2016-01-05 12:29:26 -08:00
Xudong Ma d948330ef2 [OkHttp]Add hostname verification. 2015-12-21 11:30:02 -08:00
Carl Mastrangelo d3d8adbab6 Allow support for nanosecond timeouts, and use nanoseconds consistently throughout our code 2015-12-17 18:22:47 -08:00
Carl Mastrangelo b9cacc1553 update tests 2015-12-14 16:09:28 -08:00
Carl Mastrangelo 7ac44928be Fix bug where server wouldn't declare the negotiated compression 2015-12-14 15:48:01 -08:00
Carl Mastrangelo 3fef40368d Make TestUtils able to read from input stream. This makes it easier to pass in an input stream from a resource 2015-12-07 17:28:25 -08:00
Louis Ryan be6008666e Initial basic implementation of context binding for clients with some limited testing
Adds utility functions for working with Contexts and interceptors
Use 'name' as Context.Key.toString to make conversion to Metadata simpler
2015-12-02 15:33:58 -08:00
nmittler 9a5c9cdcbd Use ServerBuilder interface in AbstractTransportTest. 2015-11-04 08:05:31 -08:00
Xudong Ma bfbd6e1ec5 Expose unimplemented_method test to interop test client. 2015-10-18 10:48:02 -07:00
Xudong Ma b1430aeda8 Expose timeout_on_sleeping_server test to interop test client. 2015-10-14 16:31:25 -07:00
Xudong Ma ea4eed57b9 Reduce memory usage in test. 2015-09-24 15:06:35 -07:00
Xudong Ma 47ad6f81bf Fix the double-closure of server call for interop tests. 2015-09-15 16:40:59 -07:00
Kun Zhang ff3dbf7b0a Deprecate OkHttpChannelBuilder#overrideHostForAuthority
It is a duplication of overrideAuthority().
2015-09-11 16:22:36 -07:00
Carl Mastrangelo 49bb24c25f Make Interop Server block until shutdown 2015-09-11 16:01:34 -07:00
Eric Anderson a6621daca2 Private ServerMethodDefinition constructor; avoid create() in codegen
There is no need to use ServerMethodDefinition in codegen. The create()
method itself could be helpful to a dynamic HandlerRegistry
implementation, so we won't remove it.
2015-09-11 09:25:24 -07:00
nmittler a0f0790cc7 Make tcnative available to the interop scripts. 2015-09-10 16:13:32 -07:00
Eric Anderson be0d7e911a Prevent construction of container classes and reduce API 2015-09-10 10:09:13 -07:00
Eric Anderson 23e6318156 Reduce API surface of AbstractStub 2015-09-10 08:36:08 -07:00
nmittler 9466eb5014 Adding tc_native to interop test scripts
Also adding better server error log
2015-09-09 07:16:49 -07:00
Xudong Ma bdaf7b3236 okhttp: Skip trash data for finished stream. 2015-09-03 23:44:43 -07:00
Eric Anderson 47a7ccf0cb Avoid Parser for normal protobuf
Eventually, this could avoid allocating Parser, since we can use
newBuilderForType().mergeFrom(). This would primarily benefit Lite
proto.
2015-09-03 17:31:16 -07:00
Eric Anderson 0336a701eb Revert "Merge pull request #940 from nmittler/interop_openssl"
This reverts commit 2aecb6f02b, reversing
changes made to 5d34599390.

The change broke OkHttp's tests
2015-09-03 16:32:01 -07:00
nmittler 79aec3b3c5 Enabling openssl in interop-testing scripts 2015-09-03 13:48:21 -07:00
nmittler b687bdc742 Refactoring channel API.
Client:
* New ManagedChannel abstract class.
* Adding ping to Channel.
* Moving builders and implementations to internal.

Server:
* Added lifecycle management API to Server (mirroring ManagedChannel).
* Moved ServerImpl, AbstractServerBuilder and handler registries to internal.
* New ServerBuilder abstract class (mirroring ManagedChannelBuilder).

Fixes #545
2015-09-03 11:22:29 -07:00
Eric Anderson c68f9ffce0 Implement jwt_token_creds interop test
Using a JWT is a bit more work than it should be, but improving that
will come later.

At present, this test fails, but it is believed to be due to the auth
library.
2015-09-03 10:38:18 -07:00
Xudong Ma d5bd33ca1b Fix generated code reference for intellij projects. 2015-09-02 14:18:31 -07:00
David P. Baker 66b984ca9d Extract the fully-qualified service name into a public static final field on the service container type. 2015-09-02 13:42:46 -07:00
Xudong Ma 0a51f0fbd9 Move StreamRecorder to testing package. 2015-09-01 09:15:03 -07:00
Kun Zhang 5bb0ea9899 Annotate method descritpor files in the generated code with ExperimentalApi 2015-08-31 09:56:44 -07:00
Kun Zhang bd23a8d693 Upgrade to protobuf-3.0.0-beta-1 2015-08-31 09:26:20 -07:00
Xudong Ma 0958fd407e Fix flakiness in test timeoutOnSleepingServer 2015-08-27 22:52:01 -07:00
Xudong Ma 1f0cad21e5 Implement per_rpc_creds test 2015-08-27 16:28:31 -07:00
Xiao Hang 3c79c52427 Implement timeout_on_sleeping_server test 2015-08-27 16:21:52 -07:00
Xiao Hang 7fc86e5549 Implement unimplemented_method test 2015-08-27 12:56:50 -07:00
Louis Ryan a4c821d94e Rename onValue to onNext in StreamObserver to align with the naming in Rx & the proposed Flow API in
Java9
2015-08-26 17:38:22 -07:00
Carl Mastrangelo a508c1d4f5 Remove Headers 2015-08-24 11:41:10 -07:00
nmittler e2f88fa904 Moving a few common utilities to GrpcUtil. 2015-08-24 07:53:32 -07:00
nmittler 9f7cb80108 Adding handling for stream exhaustion in Netty. 2015-08-21 13:01:17 -07:00
Kun Zhang 042b278256 Remove the first MethodDescriptor constructor.
that takes the service name and method name separately.

Also fix tests that are still using the old full qualified method name
format.
2015-08-20 14:19:50 -07:00
Xudong Ma b83742d61c Implement Connection Backoff Interop test. 2015-08-19 21:39:04 -07:00
Carl Mastrangelo 572f4332a7 Remove Trailers 2015-08-13 17:11:29 -07:00