use of org.apache.http.nio.reactor.ConnectingIOReactor in project jmeter by apache.
the class HttpMetricsSender method setup.
/**
* The HTTP API is the primary means of writing data into InfluxDB, by
* sending POST requests to the /write endpoint. Initiate the HttpClient
* client with a HttpPost request from influxdb url
*
* @param influxdbUrl
* example : http://localhost:8086/write?db=myd&rp=one_week
* @see org.apache.jmeter.visualizers.backend.influxdb.InfluxdbMetricsSender#setup(java.lang.String)
*/
@Override
public void setup(String influxdbUrl) throws Exception {
// Create I/O reactor configuration
IOReactorConfig ioReactorConfig = IOReactorConfig.custom().setIoThreadCount(1).setConnectTimeout(JMeterUtils.getPropDefault("backend_influxdb.connection_timeout", 1000)).setSoTimeout(JMeterUtils.getPropDefault("backend_influxdb.socket_timeout", 3000)).build();
// Create a custom I/O reactor
ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(ioReactorConfig);
// Create a connection manager with custom configuration.
PoolingNHttpClientConnectionManager connManager = new PoolingNHttpClientConnectionManager(ioReactor);
httpClient = HttpAsyncClientBuilder.create().setConnectionManager(connManager).setMaxConnPerRoute(2).setMaxConnTotal(2).setUserAgent("ApacheJMeter" + JMeterUtils.getJMeterVersion()).disableCookieManagement().disableConnectionState().build();
url = new URL(influxdbUrl);
httpRequest = createRequest(url);
httpClient.start();
}
Aggregations