Commit Graph

1602 Commits

Author SHA1 Message Date
Kun Zhang 63d54731cc Sync load_balancer.proto to latest version. 2016-08-22 15:53:34 -07:00
mfcripps 8a0c89a9f8 integration-tests: add integration tests for auto window sizing 2016-08-19 15:55:39 -07:00
Eric Anderson 092496bcc9 interop-testing: Remove hard-coded ports in ProxyTest 2016-08-19 12:58:12 -07:00
mfcripps d854da63d9 interop-tests: reduce flakiness of proxy tests 2016-08-19 12:46:20 -07:00
Eric Anderson 1f7fb044ab docs: Android examples moved for sed in RELEASING.md
examples/android/app/build.gradle is now
examples/android/helloworld/app/build.gradle and
examples/android/routeguide/app/build.gradle.

Since the number of files is getting a bit long, move it to a variable.
2016-08-19 11:12:09 -07:00
Eric Anderson 57b9dd467f Update README to reference 1.0.0 2016-08-19 09:45:34 -07:00
Kun Zhang 9d747bbbcd build: upgrade to protobuf-gradle-plugin 0.8.0 2016-08-18 13:06:18 -07:00
mfcripps 9ef13a4725 netty: add window resizing to netty handlers and unit tests 2016-08-17 16:21:30 -07:00
Carl Mastrangelo c47d948a47 protobuf: copy input data before decoding
CodedInputStream is risk averse in ways that hurt performance when
parsing large messages.  gRPC knows how large the input size is as it
is being read from the wire, and only tries to parse it once the entire
message has been read in.  The message is represented as chunks of
memory strung together in a CompositeReadableBuffer, and then wrapped
in a custom BufferInputStream.

When passed to Protobuf, CodedInputStream attempts to read data out
of this InputStream into CIS's internal 4K buffer.  For messages that
are much larger, CIS copies from the input in chunks of 4K and saved in
an ArrayList.  Once the entire message size is read in, it is re-copied
into one large byte array and passed back up.  This only happens for
ByteStrings and ByteBuffers that are read out of CIS.  (See
CIS.readRawBytesSlowPath for implementation).

gRPC doesn't need this overhead, since we already have the entire
message in memory, albeit in chunks.  This change copies the composite
buffer into a single heap byte buffer, and passes this (via
UnsafeByteOperations) into CodedInputStream.  This pays one copy to
build the heap buffer, but avoids the two copes in CIS.  This also
ensures that the buffer is considered "immutable" from CIS's point of
view.

Because CIS does not have ByteString aliasing turned on, this large
buffer will not accidentally be kept in memory even if only tiny fields
from the proto are still referenced.  Instead, reading ByteStrings out
of CIS will always copy.  (This copy, and the problems it avoids, can
be turned off by calling CIS.enableAliasing.)

Benchmark results will come shortly, but initial testing shows
significant speedup in throughput tests.  Profiling has shown that
copying memory was a large time consumer for messages of size 1MB.
2016-08-17 15:45:21 -07:00
mfcripps 09d663faf1 integration test: add a flowcontrolling proxy and integration tests 2016-08-17 15:33:13 -07:00
Xiao Hang 0d89bb4942 Update android example.
Show the full stacktrace when error happens and make the result text view scrollable.
2016-08-17 14:17:32 -07:00
Eric Anderson bcf6cc51ca Simplify commands in Android README
Comments should really use '#', since it is shell. Also, we avoid
telling users to clone the git repo since 1) this is basically implicit
already and 2) it encourages them to checkout master instead of using
the latest release. This is especially helpful when the document is
referenced from http://grpc.io/docs since they specify checking out the
latest release (which is much easier to maintain when using jekyll which
is not an option here).
2016-08-17 14:12:41 -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 55942fbd37 auth: Tests should end in Test, not Tests
We use globs internally to find tests, and weren't finding these two
tests. git ls-files confirmed these were the only two files ending in
Tests.
2016-08-11 13:37:34 -07:00
Kun Zhang 7a33fae8e8 core: fix a deadlock in TransportSet.
Resolves #2152
2016-08-10 09:47:25 -07:00
Xiao Hang 3879c6a8fa Update README.md 2016-08-09 14:05:49 -07:00
Eric Anderson c8648dc54e core: Remove usage of LogExceptionRunnable from Deadline
io.grpc should not be depending on anything from internal. Also, the
convenience method of Deadline is part of our public API and shouldn't
use LogExceptionRunnable because it would surprise our users.

Swapped to lower-case 'log' since the logger is not immutable.
2016-08-09 14:02:45 -07:00
Carl Mastrangelo 5384f9706a core: propagate name resolution errors 2016-08-08 17:53:58 -07:00
Eric Anderson ff7fb5ff52 jenkins: Fix Windows build to specify Studio version
If there are multiple versions available, cmake won't choose the Visual
Studio version selected by vsvars. So we have to explicitly specify the
generator to use.

This allows grpc-java to run on the shared Windows workers instead of
its own specialized instance.
2016-08-08 09:12:15 -07:00
Carl Mastrangelo 54f5c4ba89 benchmarks: add fork join pool executor to load server too 2016-08-04 17:34:41 -07:00
Carl Mastrangelo 130d3815cf benchmarks: use a fork-join pool to reduce executor contention 2016-08-04 16:49:10 -07:00
Eric Anderson 09d7a41946 examples: Explain reason for plainText() 2016-08-04 15:33:36 -07:00
Eric Anderson 7c44a4e111 docs: Clarify the relationship between Status*Exception 2016-08-04 15:33:31 -07:00
Eric Anderson d394cef775 core: Avoid wrapping Errors in RuntimeException 2016-08-04 14:25:40 -07:00
Eric Anderson f25f55a76f docs: Update README.md before tagging release 2016-08-04 13:55:29 -07:00
Carl Mastrangelo 1aadc6c223 benchmarks: update to using jmh 1.13 2016-08-04 13:04:49 -07:00
Xiao Hang 7267c0fbed Change routeguide example to use proto 3.0.0 2016-08-04 11:47:53 -07:00
Eric Anderson ab85d8751b Update to Gradle 2.14
Is faster and includes a security fix.
2016-08-04 10:03:57 -07:00
Xiao Hang 239d6ea299 Add android route guide example and move helloworld example to its own dir 2016-08-03 14:47:10 -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 a8700a7837 Begin consuming protobuf-lite artifact
Protobuf-lite since beta-4 is now more of a fork than a subset of
protobuf-java, which may cause us problems later since lite API is not
stable. Also, lite-generated code may now depend on APIs only in
protobuf-lite, so our users must depend on the protobuf-lite runtime.
Having all our users explicitly override the dependency is bothersome to
them and can easily only expose problems only after we do a release.

So now we are doing the dependency overriding; most users should "just
work" and pick up the correct protobuf artifact. I've confirmed the
exclusion is listed in the grpc-protobuf pom and "gradle dependencies"
and "mvn dependency:tree" do not include protobuf-lite for the examples.
Vanilla protobuf users are most likely to experience any breakage, which
should detect problems more quickly since we use protobuf-java more
frequently than protobuf-lite during development.

protobuf-lite does not include pre-generated code for the well-known
protos, so users will need to generate them themselves for the moment
(google/protobuf#1889).

Note that today changing deps does not noticeably reduce the method code
for our users, since ProGuard already is stripping most classes. The
difference in output is only a reduction of 3 classes and 6 methods for
the android example.
2016-08-01 15:51:11 -07:00
Jakob Buchgraber 21b4ce70ea netty: update to 4.1.4.Final 2016-08-01 21:16:45 +02:00
Eric Anderson 5b7a21ab03 okhttp: Remove wrong status description
The != should have been ==. However, it is provable that the exception
won't be null, but we want to make that fact obvious when auditing. So
we just fail if the exception is ever null.
2016-08-01 10:43:21 -07:00
Eric Anderson fb8402fcb1 stub: Avoid double-wrapping status
780b2696 caused all failures for blocked unary stubs to have a
StatusRuntimeException as the cause of the StatusRuntimeException, with
the two exceptions having almost the same status.
2016-08-01 09:53:57 -07:00
Kun Zhang 1775ab3847 core: call newStream() and applyRequestMetadata() under context.
`ClientTransport.newStream()` and
`CallCredentials.applyRequestMetadata()` is now called under the context
of the call.  This can be used to pass any call-specific information to
`CallCredentials`.
2016-07-29 17:24:38 -07:00
Eric Anderson aa33c59f0d Slightly encourage more use of lite, instead of nano
This is basically a continuation of 4b17a2e31
2016-07-29 12:39:50 -07:00
Eric Anderson 5e1e88357c Update protobuf to 3.0.0
Fixes #2086
2016-07-29 09:31:15 -07:00
TzeKei Lee fccc282f25 examples: add an example for setting and reading error details
Add an example for setting and reading error details
2016-07-29 09:28:15 -07:00
ZHANG Dapeng 41f166fd1e doc: fix io.grpc package level javadoc not showing up
- Resolves {@link ...} with full class name
- Javadoc can show up in package-summary.html
2016-07-28 12:39:48 -07:00
Naveen Reddy Chedeti 2860959d5f Support Thrift Messages 2016-07-28 08:48:27 -07:00
Eric Anderson 563baa4a20 interop: Fix flake in cascading test due to sleeps
The value of nodeCount depended on deadlines expiring after the chain
was constructed. This is effectively the same as using Thread.sleep()
and would commonly fail if the machine was under load.

Instead of checking nodeCount after the deadline expires, we now wait
for the chain to be constructed and then cancel the RPC. This also
ensures that the cancel propagates instead of each hop just enforcing
the deadline. As a bonus, this also reduces test execution time by one
second. A new test was added for deadline propagation.

Fixes #1852
2016-07-28 08:30:33 -07:00
Xiao Hang 2506e9396a Fix examples README 2016-07-27 16:50:19 -07:00
Carl Mastrangelo efc5cf50b7 benchmarks: avoid 2 copies in favor of one
MessageFramer calls Drainable.drainTo with a special output stream of
OutputStreamAdapter.  Currently, ByteBufInputStream writes to this output
stream by allocating a heapBuffer in UnsafeByteBufUtil.getBytes, copying
from the direct byte buffer of BBIS, and then copies to the direct byte
buffer from MessageFramer.writeRaw().

This change is an easy way to cut down on wasted memory, even though
ideally there would be some way to have less copies.  The actual data is
only around 10 bytes, but causes O(10)s of megabytes allocation for the
heap pool.

For #2062
2016-07-26 10:38:03 -07:00
Eric Anderson fbd3f529ef android: Remove providers from ProGuard configuration
We are no longer using resources to load providers on Android. Instead,
we are calling Class.forName() for known providers. ProGuard is able to
detect these usages automatically.
2016-07-25 14:43:08 -07:00
Kun Zhang 093ab06530 core: Log a warning in ClientCall.cancel if no detail is provided.
Resolves #2054
2016-07-25 10:30:54 -07:00
Sky Ao 841c7c4bfa docs: update grpc version to 0.15.0 and protoc to 3.0.0-beta-3 2016-07-25 09:58:43 -07:00
Kun Zhang d0c173b5d2 core: Remove default implementation for ClientCall.cancel.
Resolves #2050
2016-07-25 09:50:06 -07:00
ZHANG Dapeng 8f5adf83fb compiler: flip enable_deprecated option to false (#2080)
resolves #1469 externally
2016-07-22 16:35:00 -07:00
Carl Mastrangelo bfd12e4a86 benchmarks: improve benchmarks recording and shutdown
The benchmarks today do not have a good way to record metrics with precision
or shutdown safely when the benchmark is over.  This change alters the
AbstractBenchmark class to return a latch that can be waited upon when ending
the benchmark.

Benchmarks also would accidentally request way too many messages from the
server by calling request(1) explicitly in addition to the implicit one
in the StreamObserver to Call adapter.  This change adds a few outstanding
requests, but otherwise keeps the request count bounded.

Additionally, benchmark calls would ignore errors, and just shutdown in such
cases.  This changes them to log the error and just wait for the benchmark to
complete.  In the successful case, the benchmark client notifies server by
halfClosing (via onCompleted) where it previously did not.  It is also
careful to only do this once.

Lastly, Benchmarks have been changes to enable and disable recording at exact
points in the benchmark method, rather than waiting for teardown to occur.
Also, recording begins inside the recording method, not in Setup.  JMH may
do other procressing before, between, and after iterations.
2016-07-22 14:55:03 -07:00
Louis Ryan e276359f0e Force the immediate release of reference counted resources on AppEngine
to avoid executors backed by request-scoped threads from becoming
zombies
See
https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/ThreadManager.html#currentRequestThreadFactory--
2016-07-22 13:56:44 -07:00