-
Notifications
You must be signed in to change notification settings - Fork 997
[POC] Server-side integration for xDS #6797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| RESULTS_DIR="benchmarks/jmh/build/results/jmh" | ||
| AGGREGATE_FILE="$RESULTS_DIR/aggregate-results.txt" | ||
| mkdir -p "$RESULTS_DIR" | ||
|
|
||
| : > "$AGGREGATE_FILE" | ||
|
|
||
| for threads in 10 50 200 500 1000; do | ||
| echo "=== Running with threads=$threads ===" | ||
| ./gradlew :benchmarks:jmh:jmh \ | ||
| -Pjmh.includes=HttpsConnectionBenchmark \ | ||
| -Pjmh.profilers=gc \ | ||
| -Pjmh.iterations=3 \ | ||
| -Pjmh.warmupIterations=1 \ | ||
| -Pjmh.fork=1 \ | ||
| -Pjmh.threads="$threads" | ||
|
|
||
| echo "" >> "$AGGREGATE_FILE" | ||
| echo "=== threads=$threads ===" >> "$AGGREGATE_FILE" | ||
| cat "$RESULTS_DIR/results.txt" >> "$AGGREGATE_FILE" | ||
| done | ||
|
|
||
| echo "" | ||
| echo "=== Aggregated results ===" | ||
| cat "$AGGREGATE_FILE" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -63,6 +63,7 @@ | |||||||||||||||||||||||
| import com.linecorp.armeria.internal.common.NonWrappingRequestContext; | ||||||||||||||||||||||||
| import com.linecorp.armeria.internal.common.util.TemporaryThreadLocals; | ||||||||||||||||||||||||
| import com.linecorp.armeria.internal.server.RouteDecoratingService.InitialDispatcherService; | ||||||||||||||||||||||||
| import com.linecorp.armeria.server.ConnectionContext; | ||||||||||||||||||||||||
| import com.linecorp.armeria.server.HttpService; | ||||||||||||||||||||||||
| import com.linecorp.armeria.server.ProxiedAddresses; | ||||||||||||||||||||||||
| import com.linecorp.armeria.server.Route; | ||||||||||||||||||||||||
|
|
@@ -107,6 +108,7 @@ public final class DefaultServiceRequestContext | |||||||||||||||||||||||
| private final InetAddress clientAddress; | ||||||||||||||||||||||||
| private final InetSocketAddress remoteAddress; | ||||||||||||||||||||||||
| private final InetSocketAddress localAddress; | ||||||||||||||||||||||||
| private final ConnectionContext connectionContext; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| private boolean shouldReportUnloggedExceptions = true; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -151,12 +153,14 @@ public DefaultServiceRequestContext( | |||||||||||||||||||||||
| RoutingResult routingResult, ExchangeType exchangeType, | ||||||||||||||||||||||||
| HttpRequest req, @Nullable SSLSession sslSession, ProxiedAddresses proxiedAddresses, | ||||||||||||||||||||||||
| InetAddress clientAddress, InetSocketAddress remoteAddress, InetSocketAddress localAddress, | ||||||||||||||||||||||||
| ConnectionContext connectionContext, | ||||||||||||||||||||||||
| long requestStartTimeNanos, long requestStartTimeMicros, | ||||||||||||||||||||||||
| Supplier<? extends AutoCloseable> contextHook) { | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| this(cfg, ch, eventLoop, meterRegistry, sessionProtocol, id, routingContext, routingResult, | ||||||||||||||||||||||||
| exchangeType, req, sslSession, proxiedAddresses, clientAddress, remoteAddress, localAddress, | ||||||||||||||||||||||||
| null /* requestCancellationScheduler */, requestStartTimeNanos, requestStartTimeMicros, | ||||||||||||||||||||||||
| connectionContext, null /* requestCancellationScheduler */, | ||||||||||||||||||||||||
| requestStartTimeNanos, requestStartTimeMicros, | ||||||||||||||||||||||||
| HttpHeaders.of(), HttpHeaders.of(), contextHook); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -166,6 +170,7 @@ public DefaultServiceRequestContext( | |||||||||||||||||||||||
| RoutingResult routingResult, ExchangeType exchangeType, | ||||||||||||||||||||||||
| HttpRequest req, @Nullable SSLSession sslSession, ProxiedAddresses proxiedAddresses, | ||||||||||||||||||||||||
| InetAddress clientAddress, InetSocketAddress remoteAddress, InetSocketAddress localAddress, | ||||||||||||||||||||||||
| ConnectionContext connectionContext, | ||||||||||||||||||||||||
| @Nullable CancellationScheduler requestCancellationScheduler, | ||||||||||||||||||||||||
| long requestStartTimeNanos, long requestStartTimeMicros, | ||||||||||||||||||||||||
| HttpHeaders additionalResponseHeaders, HttpHeaders additionalResponseTrailers, | ||||||||||||||||||||||||
|
|
@@ -196,6 +201,7 @@ public DefaultServiceRequestContext( | |||||||||||||||||||||||
| this.clientAddress = requireNonNull(clientAddress, "clientAddress"); | ||||||||||||||||||||||||
| this.remoteAddress = requireNonNull(remoteAddress, "remoteAddress"); | ||||||||||||||||||||||||
| this.localAddress = requireNonNull(localAddress, "localAddress"); | ||||||||||||||||||||||||
| this.connectionContext = requireNonNull(connectionContext, "connectionContext"); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| log = RequestLog.builder(this); | ||||||||||||||||||||||||
| log.startRequest(requestStartTimeNanos, requestStartTimeMicros); | ||||||||||||||||||||||||
|
|
@@ -255,11 +261,16 @@ public InetAddress clientAddress() { | |||||||||||||||||||||||
| return clientAddress; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
| @Nullable | ||||||||||||||||||||||||
| protected Channel channel() { | ||||||||||||||||||||||||
| return ch; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
| public ConnectionContext connectionContext() { | ||||||||||||||||||||||||
| return connectionContext; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+269
to
+272
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Javadoc for the new public method. The 📝 Suggested Javadoc+ /**
+ * Returns the {`@link` ConnectionContext} for this request.
+ */
`@Override`
public ConnectionContext connectionContext() {As per coding guidelines: "ensure all public classes and public/protected methods have Javadoc." 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
| public ServiceConfig config() { | ||||||||||||||||||||||||
| return cfg; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove incorrect
@Nullableannotation fromchannel().The
channel()method is annotated with@Nullable, but thechfield is validated as non-null in the constructor (line 185:requireNonNull(ch, "ch")), so this method always returns a non-null value.🔧 Proposed fix
- `@Nullable` protected Channel channel() { return ch; }📝 Committable suggestion
🤖 Prompt for AI Agents