Configuring Liberty HTTP Timeouts and Keep-Alive | Generated by AI

Home 2025.10

Configuring Keep-Alive Settings

WebSphere Liberty Profile handles HTTP keep-alive connections through the <httpEndpoint> element in server.xml. This element controls persistent connections to reduce latency and overhead.

To configure, add or modify the <httpEndpoint> element under the <server> root in server.xml. Example:

<server>
    <!-- Other configurations -->
    <httpEndpoint id="defaultHttpEndpoint" host="*"
        keepAlive="true"
        keepAliveTimeout="60"/>
</server>

Restart the server for changes to take effect. TCP-level keep-alives can be adjusted via <tcpOptions> if needed, but HTTP keep-alive is more common for web traffic.

Configuring Timeout Settings

Timeouts in Liberty’s server.xml primarily relate to connection timeouts under <httpEndpoint>, controlling how long the server waits for operations. These apply to HTTP communication.

Session-specific timeouts (e.g., for web app sessions) are configured in web.xml or via <sessionManager> in server.xml, not directly in <httpEndpoint>.

Example server.xml configuration:

<server>
    <!-- Other configurations -->
    <httpEndpoint id="defaultHttpEndpoint" host="*"
        connectionTimeout="30"
        readTimeout="120"
        writeTimeout="120"/>
</server>

Adjust values based on your application’s requirements, such as higher timeouts for slow networks or long-running requests. Monitor logs for timeout-related errors and restart the server after changes. For more details, refer to the IBM Liberty documentation on HTTP endpoints.


Back

x-ai/grok-4-fast:free

Donate