6. Technical Challenges
> Asynchronous server application
> Armeria in Production
> Pre-sharded MySql databases
> Server Push based on Subscriptions
> Dynamic Configuration
> …
7. Technical Challenges
> Asynchronous server application
> Armeria in Production
> Pre-sharded MySql databases
> Server Push based on Subscriptions
> Dynamic Configuration
> …
16. ThttpService
> Interop w/rxJava2
@Override
public void sendMessage(SendMessageRequest request, AsyncMethodCallback resultHandler)
throws TException {
AuthenticationContext context = authenticationManager.getContext();
Single<SendMessageResponse> delegate = Single.defer(
() -> messageService.sendMessage(context, request));
setAsyncResult(resultHandler, () -> delegate);
}
o Subscribes `Single`
o Hands over a result or throws an error
o Translations the `Thrown`
22. Decorators
A ‘decorating service/client’ (or a ‘decorator’) is a Service/Client that wraps another Service/Client
to intercept an incoming request or an outgoing response.
As its name says, it is an implementation of the decorator pattern.
28. @Override
public O serve(ServiceRequestContext ctx, I req) throws Exception {
// For example,
long requestId = System.currentTimeMillis();
ctx.attr(ATTRIBUTE_KEY).set(requestId);
// Copy to a child
ctx.onChild((curCtx, newCtx) -> {
if (curCtx.hasAttr(ATTRIBUTE_KEY)) {
// Set the id to newCtx's attr
}
});
return delegate().serve(ctx, req);
}
RequestIdService
>Recommended & Required
>Similar to Logback’s MDC (Mapped Dignostic Context)
40. Ep 0. Learning Curve
https://www.psywww.com/intropsych/ch07-cognition/motor-activity.html
41. Ep 0. Learning Curve
https://www.psywww.com/intropsych/ch07-cognition/motor-activity.html
>Armeria?!
>How to make the API?
>Logging?!
>Metrics?
>Bug Investigation..?!
>Decorators?!!
42. Ep 0. Learning Curve
> ServerBuilder vs ThriftServiceRegistrationBean
> ServerBuilder vs AnnotatedServiceRegistrationBean
> HttpClient vs RetrofitArmeriaClient
> Custom ExceptionHandling vs ExceptionHandler interface
> AOP vs Decorators
43. > ServerBuilder vs ThriftServiceRegistrationBean
> ServerBuilder vs AnnotatedServiceRegistrationBean
> HttpClient vs RetrofitArmeriaClient
> Custom ExceptionHandling vs ExceptionHandler interface
> AOP vs Decorators
Ep 0. Learning Curve
48. Ep 1. Boot Up
AutoConfigration
ArmeriaSettings
ServiceRegistrationBeans
49. Ep 1. Boot Up
AutoConfigration
ArmeriaSettings
ServiceDecorators
ServiceRegistrationBeans
50. Ep 2. Efficiency
> n(connection) = n(core)*2
• Under the most frequently invoked cases,
• Server requests ~10K/min
• Client requests ~100K/min
51. Ep 3. Outage
> Upstream Outage
• Notification Server Failure
notification
response
timeout
52. Ep 3. Outage
> Upstream Outage
• Notification Server Failure
> Impact Scope
• Partial notification failure
• No big problem to serve
the other APIs
Async Client
notification
response
timeout
55. Ep 3. Outage
>Thread Blocking
request
armeria
io-thread
working
thread
< long time processing >
56. Ep 3. Outage
>Thread Blocking
request
armeria
io-thread
armeria
io-thread
working
thread
< long time processing >
working
thread
request
57. Ep 3. Outage
>Thread Blocking
request
armeria
io-thread
armeria
io-thread
working
thread
working
thread
response
armeria
io-thread
< long time processing >
58. Ep 3. Outage
>Thread Blocking
request
armeria
io-thread
armeria
io-thread
working
thread
< long time processing >
working
thread
response
armeria
io-thread
armeria
io-thread
59. Ep 3. Outage
>Thread Blocking
request
armeria
io-thread
armeria
io-thread
working
thread
< long time processing >
working
thread
response
armeria
io-thread
armeria
io-thread
60. Ep 3. Outage
>Should avoid blocking armeria io threads
request
armeria
io-thread
armeria
io-thread
working
thread
< long time processing >
working
thread
response
armeria
io-thread
working
thread
working
thread
armeria
io-thread
64. Ep 0. Learning Curve
https://www.psywww.com/intropsych/ch07-cognition/motor-activity.html
>Armeria?!
>How to make the API?
>Logging?!
>Metrics?
>Bug Investigation..?!
>Decorators?!!