You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by SenthilKumar K <se...@gmail.com> on 2017/12/19 11:48:00 UTC

Apache Async Http Client for 200K Requests Per Second

Hi All ,  I have been trying different options for sending data to an
EndPoint in Async way and found Apache Http Client is good candidate for my
use case.


Use Case:   We have end system called SumoLogic (https://help.sumologic.com/
Send-Data/Hosted-Collectors/Configure-a-Hosted-Collector). Sumologic
exposes Http EndPoint for other systems to ingest data .

Per day we collect 2 TB of data and send it to SumoLogic ... So we want to
try with Async Client for POSTing data to SumoLogic.

No of requests per second :  Average  ~150K  , Peak  3*150 K ( if any
attacks ).

Can this Apache Asynce HttpClient help here to achieve atleast ~100+K rps
?   What are recommend settings for achieving ~100 - 150 K rps ?.

Here is my Current Client Settings:

private final ConnectingIOReactor ioreactor;

    private final PoolingNHttpClientConnectionManager mgr;

    private final CloseableHttpAsyncClient httpclient;



    public ApacheHttpAsyncClient(final String endPoint) throws Exception {

    final URL url = getURL(endPoint);

    Preconditions.checkNotNull(url);

    final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()


.setIoThreadCount(Runtime.getRuntime().availableProcessors())

                .setConnectTimeout(30000)

                .setSoTimeout(30000)

                .setTcpNoDelay(true)

                .setSoKeepAlive(true)

                .setSoReuseAddress(true)

                .build();

        final RequestConfig requestConfig = RequestConfig.custom()

                .setSocketTimeout(3000)

                .setConnectTimeout(3000)

                .build();

        final MessageConstraints messageConstraints =
MessageConstraints.custom()

                .setMaxHeaderCount(200)

                .setMaxLineLength(2000)

                .build();

        final ConnectionConfig connectionConfig = ConnectionConfig.custom()

                .setBufferSize(8 * 1024)

                .setMessageConstraints(messageConstraints)

                .setFragmentSizeHint(8 * 1024)

                .build();

        this.ioreactor = new DefaultConnectingIOReactor(ioReactorConfig);

        this.mgr = new PoolingNHttpClientConnectionManager(this.ioreactor);

        this.mgr.setDefaultConnectionConfig(connectionConfig);

        this.mgr.setMaxTotal(200);

        this.mgr.setDefaultMaxPerRoute(10);

        this.httpclient = HttpAsyncClients.custom()

        .setConnectionManager(mgr)

        .setDefaultRequestConfig(requestConfig)

        .build();

With above setup , i can achieve only 10K rps.

Appreciate your help !

--Senthil