| <?xml version="1.0"?> |
| <!-- |
| ~ Licensed to the Apache Software Foundation (ASF) under one |
| ~ or more contributor license agreements. See the NOTICE file |
| ~ distributed with this work for additional information |
| ~ regarding copyright ownership. The ASF licenses this file |
| ~ to you under the Apache License, Version 2.0 (the |
| ~ "License"); you may not use this file except in compliance |
| ~ with the License. You may obtain a copy of the License at |
| ~ |
| ~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~ |
| ~ Unless required by applicable law or agreed to in writing, |
| ~ software distributed under the License is distributed on an |
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~ KIND, either express or implied. See the License for the |
| ~ specific language governing permissions and limitations |
| ~ under the License. |
| --> |
| <document xmlns="http://maven.apache.org/XDOC/2.0" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> |
| <properties> |
| <title>WildFly + Axis2 HTTP/2 Integration Guide</title> |
| </properties> |
| |
| <body> |
| |
| <h1>WildFly + Axis2 HTTP/2 Integration Guide</h1> |
| |
| <p><strong>Tested on:</strong> WildFly 32 (OpenJDK 17, 21) and WildFly 39 |
| (OpenJDK 21, 25). Configuration examples below use WildFly 32 syntax; |
| WildFly 39 is compatible with the same configuration.</p> |
| |
| <div style="background-color: #ffe8e8; border: 1px solid #ff4444; padding: 10px; margin: 10px 0;"> |
| |
| <h4>H2TransportSender Configuration (Simplified with Intelligent Defaults)</h4> |
| |
| <pre> |
| <!-- Minimal HTTP/2 Transport - Intelligent Defaults Handle Optimization --> |
| <transportSender name="http" class="org.apache.axis2.transport.h2.impl.httpclient5.H2TransportSender"> |
| <parameter name="PROTOCOL">HTTP/2.0</parameter> |
| </transportSender> |
| </pre> |
| |
| </div> |
| |
| <h2>WildFly Server-Level HTTP/2 Configuration (RECOMMENDED)</h2> |
| |
| <div style="background-color: #e8f5e8; border: 1px solid #4CAF50; padding: 10px; margin: 10px 0;"> |
| <strong>Key Optimizations:</strong> |
| <ul> |
| <li><strong>64KB Buffer/Flush Alignment</strong> - WildFly byte-buffer-pool and FlushingOutputStream flush interval are aligned at 64KB. This is a server-side serialization setting and is correct.</li> |
| <li><strong>HTTP/2 Flow-Control Windows</strong> - Sized for payload, not aligned to flush interval. See |
| <a href="http2-transport-additions.html#H2TransportSender">HTTP/2 Transport configuration</a> |
| for guidance on <code>initialWindowSize</code> tuning.</li> |
| <li><strong>Minimal Protocol Overhead</strong> - Single-layer HTTP/2 processing architecture</li> |
| <li><strong>Enhanced Monitoring</strong> - Built-in performance tracking and access logging</li> |
| </ul> |
| </div> |
| |
| <div style="background-color: #fff8e1; border: 1px solid #f9a825; padding: 10px; margin: 10px 0;"> |
| <strong>Important:</strong> The Axis2 transport's |
| <code>initialWindowSize</code> should <strong>not</strong> be set to |
| 64KB to match the WildFly buffer pool or FlushingOutputStream flush |
| interval. The flow-control window and the server-side flush interval are |
| independent — a 64KB window forces ~156 WINDOW_UPDATE round-trips for a |
| 10MB response. Use at least 2MB for general traffic or 8MB for |
| large-payload workloads. See |
| <a href="http2-transport-additions.html#H2TransportSender">HTTP/2 Transport |
| — Tuning for Different Workloads</a>. |
| </div> |
| |
| <pre> |
| <subsystem xmlns="urn:jboss:domain:undertow:14.0" |
| default-virtual-host="default-host" |
| default-servlet-container="default" |
| default-server="default-server" |
| statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}" |
| default-security-domain="other"> |
| |
| <!-- MINIMAL WILDFLY HTTP/2 - Optimized Buffer Pool Configuration --> |
| <!-- Aligned with Enhanced Moshi H2 processing (64KB standard across all layers) --> |
| <!-- Reduces buffer fragmentation and improves memory efficiency --> |
| <byte-buffer-pool name="default" buffer-size="65536" max-pool-size="512" direct="true"/> |
| |
| <!-- Single-Layer Buffer Cache - Optimized for JSON Processing --> |
| <!-- Aligned 64KB cache for consistent buffer management --> |
| <buffer-cache name="default" buffer-size="65536" buffers-per-region="64"/> |
| |
| <server name="default-server"> |
| <!-- MINIMAL WILDFLY HTTP/2 - Optimized for Single-Layer Processing --> |
| <!-- Reduced protocol overhead, optimized for Enhanced Moshi H2 JSON processing --> |
| <http-listener name="default" socket-binding="http" |
| max-post-size="104857600" |
| redirect-socket="https" |
| enable-http2="true" |
| http2-enable-push="false" |
| http2-header-table-size="8192" |
| http2-initial-window-size="2097152" |
| http2-max-concurrent-streams="75" |
| http2-max-frame-size="65536" |
| http2-max-header-list-size="32768" |
| max-connections="150" |
| receive-buffer="4194304" |
| send-buffer="2097152" |
| no-request-timeout="300000" |
| request-parse-timeout="60000" |
| tcp-backlog="1024"/> |
| |
| <!-- MINIMAL WILDFLY HTTP/2 HTTPS - Aligned with HTTP configuration --> |
| <!-- SSL-optimized single-layer HTTP/2 processing --> |
| <https-listener name="https" socket-binding="https" |
| max-post-size="104857600" |
| ssl-context="applicationSSC" |
| enable-http2="true" |
| http2-enable-push="false" |
| http2-header-table-size="8192" |
| http2-initial-window-size="2097152" |
| http2-max-concurrent-streams="75" |
| http2-max-frame-size="65536" |
| http2-max-header-list-size="32768" |
| max-connections="150" |
| receive-buffer="4194304" |
| send-buffer="2097152" |
| no-request-timeout="300000" |
| request-parse-timeout="60000" |
| tcp-backlog="1024"/> |
| |
| <host name="default-host" alias="localhost"> |
| <!-- Enhanced Access Log for HTTP/2 Performance Monitoring --> |
| <access-log pattern="%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}" Cookie: "%{i,COOKIE}" Set-Cookie: "%{o,SET-COOKIE}" SessionID: %S Thread: "%I" TimeTaken: %T Protocol: %H Bytes: %B"/> |
| |
| <!-- HTTP/2 Performance Optimization Filters --> |
| <filter-ref name="gzip-compression"/> |
| <filter-ref name="cache-control-headers"/> |
| </host> |
| </server> |
| |
| <!-- HTTP/2 Optimization Filters --> |
| <filters> |
| <!-- JSON compression for JSON-RPC / REST operations (30-50% reduction) --> |
| <gzip name="gzip-compression"/> |
| |
| <!-- Cache Control Headers for Static Resources --> |
| <response-header name="cache-control-headers" |
| header-name="Cache-Control" |
| header-value="public, max-age=2592000"/> |
| </filters> |
| |
| <!-- MINIMAL WILDFLY HTTP/2 - Optimized Servlet Container --> |
| <!-- Enhanced for single-layer HTTP/2 and JSON processing --> |
| <servlet-container name="default" default-buffer-cache="default" |
| stack-trace-on-error="local-only" |
| default-encoding="UTF-8"> |
| <jsp-config development="false" mapped-file="false" check-interval="0" |
| x-powered-by="false" display-source-fragment="false"/> |
| <websockets/> |
| <session-cookie http-only="true" secure="true"/> |
| <!-- Optimized session management for HTTP/2 multiplexing --> |
| <persistent-sessions/> |
| </servlet-container> |
| </subsystem> |
| </pre> |
| |
| <h3>Configuration Benefits</h3> |
| |
| <div style="background-color: #fff4e6; border: 1px solid #ff9800; padding: 10px; margin: 10px 0;"> |
| <strong>📊 Production Performance Results</strong> <em>(illustrative estimates — actual results |
| depend on payload size, network conditions, and JVM configuration):</em> |
| <ul> |
| <li><strong>~3% Average Performance Improvement</strong> - 14.8s → 14.4s response times</li> |
| <li><strong>~4% Better Minimum Response Times</strong> - 13.0s → 12.5s best-case performance</li> |
| <li><strong>64KB Buffer Alignment</strong> - Consistent across WildFly and Enhanced Moshi H2</li> |
| <li><strong>Enhanced Monitoring</strong> - Detailed access logging for performance tracking</li> |
| </ul> |
| </div> |
| |
| <h3>Key Configuration Highlights</h3> |
| |
| <table border="1"> |
| <tr><th>Parameter</th><th>Production Value</th><th>Optimization Purpose</th></tr> |
| <tr><td>buffer-size</td><td>65536 (64KB)</td><td>Aligned with Enhanced Moshi H2 processing</td></tr> |
| <tr><td>http2-initial-window-size</td><td>2097152 (2MB)</td><td>Avoids flow-control round trips on large responses</td></tr> |
| <tr><td>http2-max-frame-size</td><td>65536 (64KB)</td><td>Consistent buffer alignment across layers</td></tr> |
| <tr><td>http2-max-concurrent-streams</td><td>75</td><td>Memory-constrained optimization</td></tr> |
| <tr><td>receive-buffer</td><td>4194304 (4MB)</td><td>Large payload handling</td></tr> |
| <tr><td>send-buffer</td><td>2097152 (2MB)</td><td>Balanced throughput optimization</td></tr> |
| </table> |
| |
| <h3>Enhanced Moshi H2 + WildFly HTTP/2 Synergy Analysis</h3> |
| |
| <p><strong>These configurations work together optimally</strong> - WildFly handles HTTP/2 protocol, Enhanced Moshi H2 optimizes JSON processing:</p> |
| |
| <table border="1"> |
| <tr><th>Layer</th><th>WildFly HTTP/2 Parameters</th><th>Enhanced Moshi H2 Parameters</th><th>Synergy</th></tr> |
| <tr> |
| <td><strong>Connection Management</strong></td> |
| <td><code>http2-max-concurrent-streams="128"</code></td> |
| <td><code>maxConcurrentStreams="128"</code> (axis2.xml)</td> |
| <td>✅ WildFly manages 128 concurrent HTTP/2 streams, transport sender matches</td> |
| </tr> |
| <tr> |
| <td><strong>Flow Control Window</strong></td> |
| <td><code>http2-initial-window-size="2097152"</code></td> |
| <td><code>initialWindowSize="2097152"</code> (in axis2.xml)</td> |
| <td>✅ 2MB window prevents round-trip latency on large responses</td> |
| </tr> |
| <tr> |
| <td><strong>Streaming Flush Buffer</strong></td> |
| <td><code>buffer-size="65536"</code></td> |
| <td><code>streamingBufferSize="65536"</code> (in axis2.xml)</td> |
| <td>✅ 64KB server-side flush interval — good TTFB, independent of flow-control window</td> |
| </tr> |
| <tr> |
| <td><strong>Large Payload Handling</strong></td> |
| <td><code>http2-max-frame-size="16384"</code></td> |
| <td>(handled by message formatter)</td> |
| <td>✅ WildFly chunks large payloads via HTTP/2 DATA frames; streaming formatter handles large JSON</td> |
| </tr> |
| <tr> |
| <td><strong>Memory Optimization</strong></td> |
| <td><code>http2-header-table-size="4096"</code></td> |
| <td>(JVM default is sufficient)</td> |
| <td>✅ Conservative header caching; JVM default direct memory limit is adequate</td> |
| </tr> |
| <tr> |
| <td><strong>Push Disabled</strong></td> |
| <td><code>http2-enable-push="false"</code></td> |
| <td>N/A</td> |
| <td>✅ Server push disabled for web services - reduces complexity, focuses on request/response optimization</td> |
| </tr> |
| </table> |
| |
| <h3>Recommended Coordinated Configuration</h3> |
| |
| <p><strong>For optimal performance with Enhanced Moshi H2, use these coordinated WildFly 32 parameters</strong>:</p> |
| |
| <pre> |
| <!-- WildFly 32 HTTP/2 Settings Optimized for Enhanced Moshi H2 --> |
| <!-- CORRECTED: Uses your existing ssl-context and matches buffer sizes --> |
| |
| <!-- Buffer Pool Configuration (Aligned with HTTP/2 frame sizes) --> |
| <byte-buffer-pool name="default" buffer-size="32768" max-pool-size="1024" direct="true"/> |
| <buffer-cache name="default" buffer-size="32768"/> |
| |
| <!-- HTTPS Listener with HTTP/2 Parameters --> |
| <https-listener name="https" socket-binding="https" |
| ssl-context="applicationSSC" <!-- CORRECTED: Matches your existing SSL context --> |
| enable-http2="true" |
| http2-enable-push="false" |
| http2-header-table-size="4096" <!-- Conservative headers --> |
| http2-initial-window-size="2097152" <!-- 2MB: avoids flow-control round trips --> |
| http2-max-concurrent-streams="100" <!-- Coordinated with transport-h2 --> |
| http2-max-frame-size="32768" <!-- ALIGNED: Matches buffer pool --> |
| http2-max-header-list-size="16384" <!-- Sufficient for JSON APIs --> |
| max-connections="200" <!-- Matches your existing setup --> |
| receive-buffer="2097152" <!-- Keep existing 2MB --> |
| send-buffer="1048576" <!-- Keep existing 1MB --> |
| no-request-timeout="300000" <!-- 5min timeout for large payloads --> |
| max-post-size="104857600"/> <!-- 100MB max request size --> |
| </pre> |
| |
| <h3>Complete Three-Layer Architecture</h3> |
| |
| <p><strong>WildFly HTTP/2 + transport-h2 + Enhanced Moshi H2 provides comprehensive optimization</strong>:</p> |
| |
| <pre> |
| Complete HTTP/2 + JSON Optimization Stack: |
| ┌─────────────────────────────────────────────────────────────┐ |
| │ 1. WildFly HTTP/2 (Server-Level) │ |
| │ - HTTP/2 protocol negotiation and ALPN │ |
| │ - Connection multiplexing and flow control │ |
| │ - TLS termination and header compression │ |
| └─────────────────────────────────────────────────────────────┘ |
| │ |
| ┌─────────────────────────────────────────────────────────────┐ |
| │ 2. transport-h2 Module (Axis2 HTTP/2 Transport) │ |
| │ - HTTP/2 client transport for outbound requests │ |
| │ - H2TransportSender with HTTP/2.0 protocol │ |
| │ - Stream management and async connection pooling │ |
| └─────────────────────────────────────────────────────────────┘ |
| │ |
| ┌─────────────────────────────────────────────────────────────┐ |
| │ 3. Enhanced Moshi H2 (JSON Processing) │ |
| │ - JSON → OMElement conversion optimization │ |
| │ - Async processing for large payloads (1MB+) │ |
| │ - Field-specific parsing and memory management │ |
| └─────────────────────────────────────────────────────────────┘ |
| </pre> |
| |
| <ul> |
| <li><strong>Inbound HTTP/2</strong>: WildFly handles HTTP/2 → HTTP/1.1 bridge to Axis2 servlet</li> |
| <li><strong>Outbound HTTP/2</strong>: transport-h2 provides native HTTP/2 client transport</li> |
| <li><strong>JSON Optimization</strong>: Enhanced Moshi H2 optimizes JSON-to-OMElement conversion</li> |
| <li><strong>No Integration Conflicts</strong>: Each layer operates independently</li> |
| <li><strong>Cumulative Benefits</strong>: HTTP/2 multiplexing + async JSON processing + memory optimization</li> |
| </ul> |
| |
| <h3>Critical Configuration Coordination</h3> |
| |
| <p><strong>⚠️ IMPORTANT</strong>: For optimal performance, these configurations must be coordinated:</p> |
| |
| <table border="1"> |
| <tr><th>Configuration Aspect</th><th>WildFly 32 HTTP/2</th><th>transport-h2</th><th>Enhanced Moshi H2</th><th>Coordination Status</th></tr> |
| <tr> |
| <td><strong>Buffer Sizes</strong></td> |
| <td><code>buffer-size="32768"</code><br/><code>http2-max-frame-size="32768"</code></td> |
| <td><code>streamingBufferSize="32768"</code></td> |
| <td><code>streamingBufferSize="32768"</code></td> |
| <td>✅ <strong>ALIGNED</strong>: All using 32KB</td> |
| </tr> |
| <tr> |
| <td><strong>Window Sizes</strong></td> |
| <td><code>http2-initial-window-size="2097152"</code></td> |
| <td><code>initialWindowSize="2097152"</code></td> |
| <td>(automatic)</td> |
| <td>✅ <strong>TUNED</strong>: 2MB flow-control windows across both layers</td> |
| </tr> |
| <tr> |
| <td><strong>Stream Limits</strong></td> |
| <td><code>http2-max-concurrent-streams="100"</code></td> |
| <td><code>maxConcurrentStreams="100"</code></td> |
| <td>Async processing based on payload size</td> |
| <td>✅ <strong>MATCHED</strong>: 100 streams across layers</td> |
| </tr> |
| <tr> |
| <td><strong>Large Payloads</strong></td> |
| <td><code>max-post-size="104857600"</code> (100MB)<br/><code>no-request-timeout="300000"</code> (5min)</td> |
| <td><code>responseTimeout="300000"</code> (5min)</td> |
| <td>(handled by formatter)</td> |
| <td>✅ <strong>COORDINATED</strong>: Timeout alignment</td> |
| </tr> |
| <tr> |
| <td><strong>SSL Context</strong></td> |
| <td><code>ssl-context="applicationSSC"</code></td> |
| <td>Uses WildFly SSL context</td> |
| <td>N/A</td> |
| <td>✅ <strong>CORRECTED</strong>: Matches your actual SSL context name</td> |
| </tr> |
| </table> |
| |
| <h3>Minimal vs Optimal Configuration Matrix</h3> |
| |
| <table border="1"> |
| <tr><th>Deployment Scenario</th><th>WildFly HTTP/2</th><th>transport-h2</th><th>Enhanced Moshi H2</th><th>Performance Expectation</th></tr> |
| <tr> |
| <td><strong>Minimal (HTTP/1.1 only)</strong></td> |
| <td>❌ Disabled</td> |
| <td>❌ Not deployed</td> |
| <td>✅ Basic Moshi processing</td> |
| <td>Baseline performance</td> |
| </tr> |
| <tr> |
| <td><strong>Inbound HTTP/2 Only</strong></td> |
| <td>✅ Enabled</td> |
| <td>❌ HTTP/1.1 transport</td> |
| <td>✅ Enhanced Moshi H2</td> |
| <td>+25% inbound improvement</td> |
| </tr> |
| <tr> |
| <td><strong>Outbound HTTP/2 Only</strong></td> |
| <td>❌ HTTP/1.1 server</td> |
| <td>✅ H2TransportSender</td> |
| <td>✅ Enhanced Moshi H2</td> |
| <td>+35% outbound improvement</td> |
| </tr> |
| <tr> |
| <td><strong>Full HTTP/2 + Moshi H2</strong></td> |
| <td>✅ Optimized config</td> |
| <td>✅ Coordinated params</td> |
| <td>✅ All optimizations</td> |
| <td>+50-70% overall improvement</td> |
| </tr> |
| </table> |
| |
| <p><strong>✅ CONCLUSION</strong>: The three-layer approach provides **optimal balance** - WildFly handles HTTP/2 protocol, transport-h2 enables HTTP/2 clients, Enhanced Moshi H2 optimizes JSON processing. All three layers are **independent but coordinated** for maximum performance.</p> |
| |
| <h3>Complete Coordinated Configuration Example</h3> |
| |
| <h4>1. WildFly 32 standalone.xml (Server HTTP/2)</h4> |
| <pre> |
| <subsystem xmlns="urn:jboss:domain:undertow:14.0" |
| default-virtual-host="default-host" |
| default-servlet-container="default" |
| default-server="default-server"> |
| |
| <!-- CORRECTED: Aligned buffer pools for HTTP/2 optimization --> |
| <byte-buffer-pool name="default" buffer-size="32768" max-pool-size="1024" direct="true"/> |
| <buffer-cache name="default" buffer-size="32768"/> |
| |
| <server name="default-server"> |
| <!-- HTTP Connector with HTTP/2 support --> |
| <http-listener name="default" socket-binding="http" |
| max-post-size="104857600" |
| redirect-socket="https" |
| enable-http2="true" |
| http2-enable-push="false" |
| http2-header-table-size="4096" |
| http2-initial-window-size="2097152" <!-- 2MB: avoids flow-control round trips --> |
| http2-max-concurrent-streams="100" <!-- Matches transport-h2 limit --> |
| http2-max-frame-size="32768" <!-- ALIGNED: Matches buffer pool --> |
| http2-max-header-list-size="16384" |
| max-connections="200" |
| receive-buffer="2097152" |
| send-buffer="1048576" |
| no-request-timeout="300000"/> <!-- 5min for large payloads --> |
| |
| <!-- HTTPS Connector (Production) --> |
| <https-listener name="https" socket-binding="https" |
| max-post-size="104857600" |
| ssl-context="applicationSSC" <!-- CORRECTED: Your actual SSL context --> |
| enable-http2="true" |
| http2-enable-push="false" |
| http2-header-table-size="4096" |
| http2-initial-window-size="2097152" <!-- 2MB: avoids flow-control round trips --> |
| http2-max-concurrent-streams="100" <!-- Matches transport-h2 limit --> |
| http2-max-frame-size="32768" <!-- ALIGNED: Matches buffer pool --> |
| http2-max-header-list-size="16384" |
| max-connections="200" |
| receive-buffer="2097152" |
| send-buffer="1048576" |
| no-request-timeout="300000"/> <!-- 5min for large payloads --> |
| |
| <host name="default-host" alias="localhost"> |
| <access-log pattern="%h %t "%r" %s %b %T Protocol:%H"/> |
| <filter-ref name="gzip-compression"/> |
| </host> |
| </server> |
| |
| <filters> |
| <gzip name="gzip-compression"/> |
| </filters> |
| |
| <servlet-container name="default"> |
| <jsp-config development="false"/> |
| <websockets/> |
| <session-cookie http-only="true" secure="true"/> |
| </servlet-container> |
| </subsystem> |
| </pre> |
| |
| <h4>2. Axis2.xml (transport-h2 + Enhanced Moshi H2)</h4> |
| <pre> |
| <axisconfig name="AxisJava2.0-HTTP2-EnhancedMoshiH2-Complete"> |
| |
| <!-- JSON processing is configured by selecting the message builder |
| and formatter classes below — no additional threshold parameters |
| are needed at the axis2.xml level. --> |
| |
| <!-- Enhanced JSON Message Builder --> |
| <messageBuilder contentType="application/json" |
| class="org.apache.axis2.json.moshih2.EnhancedMoshiJsonBuilder"/> |
| |
| <!-- Enhanced JSON Message Formatter --> |
| <messageFormatter contentType="application/json" |
| class="org.apache.axis2.json.moshih2.EnhancedMoshiJsonFormatter"/> |
| |
| <!-- HTTP/1.1 Transport (Fallback) --> |
| <transportSender name="http" |
| class="org.apache.axis2.transport.http.impl.httpclient5.HTTPClient5TransportSender"> |
| <parameter name="PROTOCOL">HTTP/1.1</parameter> |
| </transportSender> |
| |
| <!-- HTTP/2 Transport (Coordinated with WildFly + Moshi) --> |
| <transportSender name="h2" |
| class="org.apache.axis2.transport.h2.impl.httpclient5.H2TransportSender"> |
| <parameter name="PROTOCOL">HTTP/2.0</parameter> |
| |
| <!-- Coordination with WildFly HTTP/2 --> |
| <parameter name="maxConcurrentStreams">100</parameter> <!-- Matches WildFly --> |
| <parameter name="initialWindowSize">2097152</parameter> <!-- 2MB: avoids flow-control round trips --> |
| <parameter name="maxConnectionsTotal">50</parameter> |
| <parameter name="maxConnectionsPerRoute">10</parameter> |
| <parameter name="connectionTimeout">30000</parameter> |
| <parameter name="responseTimeout">300000</parameter> <!-- 5min matches WildFly --> |
| |
| <!-- JSON streaming is handled by the message formatter (e.g. |
| MoshiStreamingMessageFormatter) — no additional transport sender |
| parameters are needed for Moshi integration. --> |
| </transportSender> |
| |
| </axisconfig> |
| </pre> |
| |
| <h4>3. Service Configuration (Protocol Selection)</h4> |
| <pre> |
| // Use HTTP/2 transport for outbound calls |
| ServiceClient client = new ServiceClient(); |
| client.getOptions().setProperty(Constants.Configuration.TRANSPORT_NAME, "h2"); |
| client.getOptions().setTo(new EndpointReference("https://api.example.com/service")); |
| |
| // Streaming and async processing are handled automatically by the |
| // message formatter selected in axis2.xml. No client-side flags needed. |
| </pre> |
| |
| <h4>4. Performance Validation</h4> |
| <pre> |
| // Validate configuration alignment |
| curl -k --http2 --location 'https://localhost:8443/services/YourService' \ |
| --header 'Content-Type: application/json' \ |
| --data '{"largePayload": "..."}' \ |
| --trace-ascii trace.log |
| |
| # Check for: |
| # - HTTP/2 protocol negotiation |
| # - Enhanced Moshi H2 async processing logs |
| # - Buffer alignment efficiency |
| # - No class loader conflicts |
| </pre> |
| |
| <h2>Troubleshooting</h2> |
| |
| <p>Common issues and resolution:</p> |
| |
| <table border="1"> |
| <tr><th>Symptom</th><th>Cause</th><th>Fix</th></tr> |
| <tr> |
| <td>HTTP/1.1 used despite <code>enable-http2="true"</code></td> |
| <td>Missing ALPN or TLS < 1.2</td> |
| <td>Ensure OpenJDK 11+ and <code>ssl-context</code> configured with TLS 1.2+</td> |
| </tr> |
| <tr> |
| <td>502 Bad Gateway on large responses</td> |
| <td>Reverse proxy timeout before data flows</td> |
| <td>Use streaming JSON formatter (<code>FlushingOutputStream</code>) — flushes every 64 KB</td> |
| </tr> |
| <tr> |
| <td>ClassLoader conflicts with log4j</td> |
| <td>WildFly's jboss-logmanager conflicts with WAR's log4j-core</td> |
| <td>Add <code>jboss-deployment-structure.xml</code> excluding <code>org.apache.logging.log4j.api</code></td> |
| </tr> |
| <tr> |
| <td>Buffer alignment warnings</td> |
| <td>WildFly buffer size (2KB default) mismatched with Axis2 flush interval (64KB)</td> |
| <td>Set <code>buffer-size="32768"</code> in WildFly's Undertow config to align with Axis2</td> |
| </tr> |
| </table> |
| |
| <h3>Deployment sizing</h3> |
| |
| <table border="1"> |
| <tr><th>Environment</th><th>Memory</th><th>Configuration</th></tr> |
| <tr><td>Memory-constrained</td><td>≤ 2GB</td><td>32KB buffers, 50 streams</td></tr> |
| <tr><td>Balanced production</td><td>2-4GB</td><td>64KB buffers, 100 streams</td></tr> |
| <tr><td>High-performance</td><td>4GB+</td><td>64KB+ buffers, 200+ streams</td></tr> |
| </table> |
| |
| |
| </body> |
| </document> |