Warning: The default timeout is set to
60 seconds. For APIs with high latency or large payloads, you can increase this value to better suit your testing needs. If the HTTP request surpasses the timeout limit, it will be automatically canceled.
HTTP Client Configuration
The HTTP Client Configuration in the LPS Tool allows you to customize the HTTP client used for sending requests during tests. Adjustments can be made to connection pooling, timeout settings, and connection limits, optimizing performance and reducing potential bottlenecks.
Command Usage
lps httpclient [options]
How It Works
- Connection Pooling: Manage the lifetime and idle timeout of connections in the connection pool to reuse connections efficiently.
- Simultaneous Connections: Set a limit on the number of simultaneous connections to a server, preventing excessive resource usage.
- Timeout Settings: Define the maximum time the HTTP client will wait for a request to complete, ensuring that tests do not hang indefinitely.
Options
Connection Pooling Options
-pclt,--poolConnectionLifeTime <poolConnectionLifeTime>: Specifies how long a connection remains in the pool before being discarded.-pcit,--poolConnectionIdelTimeout <poolConnectionIdelTimeout>: Sets the maximum time a connection can stay idle in the pool.
Simultaneous Connections
-mcps,--maxConnectionsPerServer <maxConnectionsPerServer>: Limits the number of simultaneous connections per server.
Timeout Settings
-cto,--clientTimeout <clientTimeout>: Sets the timeout for HTTP client requests.
Server Time Metrics
Capture actual server-side processing time from response headers.
-sth,--servertimeheader <headerName>: Specifies the response header name to read server processing time from. Common values:Server-Timing,X-Response-Time,X-Runtime-stf,--servertimeformat <format>: Specifies the format of the server time header value. Options:Auto(default): Auto-detects format; tries Server-Timing syntax first, then numeric with optionalmssuffixMilliseconds: Plain numeric value in millisecondsSeconds: Plain numeric value in seconds (converted to ms)ServerTiming: W3C Server-Timing format (parsesdur=values)
Expected Header Formats:
| Format | Example Header Value | Parsed Value |
|---|---|---|
| ServerTiming | db;dur=53.2, app;dur=47.2 |
100.4 ms (sum) |
| Milliseconds | 150 or 150ms |
150 ms |
| Seconds | 0.150 |
150 ms |
Additional Resources
To gain a deeper understanding of Connection Pooling and how to manage it effectively, refer to the following article:
What is Connection Pooling? and How to Control Connection Pooling?
Example Usage
Set Maximum Connections Per Server and Client Timeout
lps httpclient -mcps 100 -cto 30
Configure Connection Pool Life Time and Idle Timeout
lps httpclient -pclt 120 -pcit 15
Enable Server Time Metrics
Capture server processing time from the Server-Timing header with auto-detection:
lps httpclient --servertimeheader "Server-Timing" --servertimeformat Auto
Capture from a custom header with milliseconds format:
lps httpclient -sth "X-Response-Time" -stf Milliseconds