Comments (5)
@shelocks wrote:
what do you think about these candidates
(1, 2) and (3) are not mutually exclusive. In case of network issues, you can always retry for all proposed ideas.
the armeria is async,maybe catching the network exception in this way is not easy(need some sync test?) and has performance impact.
Not really, you can just add a listener to the Future returned by delegate().invoke(...) and decide to retry there:
Promise<T> promise = eventLoop.newPromise();
delegate().invoke(...).addListener(f -> {
...
if (success or non-network failure) {
promise.setSuccess/Failure(....);
} else {
retry();
}
});
return promise;
from armeria.
@shelocks Also, (1) and (2) are not mutually exclusive either. A user might want to use both of them.
from armeria.
In general I'm not a fan of automatic retry because there's pretty much no way to know how far your request got when it failed, even due to ClosedSocketException or whatever. Pretty much the only network failure I'd be comfortable with retrying is if the inital bits never got sent over the wire in the first place - is this something we can distinguish (seems difficult in HTTP2)? Retrying in such a situation seems great if it's possible.
Also, DB stuck, full GC stuck, etc usually need to all be handled anyways, so handling network failure in the RPC layer but leaving other random failures up to the user seems not so useful.
It's of course ok to provide a RetryingClient in case users do have a use for 3), but IMO it's really only useful for read-only APIs, which limits its applicability a lot.
I'm not sure what the difference is between 2) and 3). Both seem to rely on request failure, which have the same issues of not knowing whether it's safe to retry. Does 2 imply not retrying but using another endpoint on the next request? In that case, 2) seems good too, but not enough by itself.
- is pretty much the only way I've seen to reliably do RPC. It has the problem with random network failures that you mention, but as I mentioned above, apps need to be able to handle random failure regardless. But it will allow for safe rolling restarts - armeria server already has support for graceful shutdown using the health endpoint. A simple implementation would poll the health path on all backends, a more complex (but scalable) implementation would poll an etcd or zookeeper file. And it shouldn't be too hard to incorporate 2) into this by treating request failures by some pattern as unhealthy.
from armeria.
Agreed. Automatic retrial is only applicable in a very specific situation.
from armeria.
I guess this is pretty much solved by the RetryingClient
written by @minwoox. Great to see your effort reaches the goal. 👍
from armeria.
Related Issues (20)
- Deduplicate the code that strips the user info from authority HOT 3
- Incorrect cycle detection logic in `RedirectingClient` HOT 2
- `HttpHeaderNamesTest.httpHeaderNamesContainsAllFieldsInHttpHeadersInGuava()` fails
- `CorsService` does not inject CORS headers to error responses HOT 8
- Avoid `addShutdownHook` to JVM during its shutdown HOT 1
- Compatibility with armeria and grpc 4.26.0 versions is broken.
- Provide a way to load a value periodically or when it expires HOT 1
- Derive a new `XdsBootstrap` with `StaticResources`
- who use armeria ? HOT 1
- Support for `@Attribute` in annotated services HOT 4
- Handle an empty query parameters with `@Default` HOT 6
- `RetryingClient` propagates the exception (and whether it is unprocessed) HOT 2
- Make DocService looking up several virtual hosts to represent services in other ports
- Replace `Optional<List<T>>` parameter to `ObjectProvider<T>` HOT 3
- Leak in `ArmeriaHttpPutTest`
- Client-side load balancing for same Endpoint HOT 1
- Add ServerExtension.webSocketClient() for testing
- Do not ignore the result of StreamMessage.tryWrite() in GraphqlWSSubProtocol HOT 6
- Test failure: `com.linecorp.armeria.server.ServerRequestPathEncodingTest` HOT 2
- Make annotated services reject the multipart requests that contain an uninjectable file upload HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from armeria.