Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike in Response times : Rxnetty 0.4.x #588

Open
JanakiramanChandrasekran opened this issue May 31, 2017 · 0 comments
Open

Spike in Response times : Rxnetty 0.4.x #588

JanakiramanChandrasekran opened this issue May 31, 2017 · 0 comments

Comments

@JanakiramanChandrasekran

I see the spike in response times and its gradually growing. Seems like some settings which i am missing. Can you help me to refer that?

private final HttpClient<ByteBuf, ByteBuf> httpClient;

@Inject
public ReactiveNettyClientImpl(@Value("${gateway.host}") final String host,
        @Value("${gateway.port}") final int port) throws NoSuchAlgorithmException {
    this.httpClient = RxNetty.<ByteBuf, ByteBuf> newHttpClientBuilder(host, port)
            .pipelineConfigurator(
                    new PipelineConfiguratorComposite<HttpClientResponse<ByteBuf>, HttpClientRequest<ByteBuf>>(
                            new HttpClientPipelineConfigurator<ByteBuf, ByteBuf>(), gzipPipelineConfigurator))
            .channelOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 2000)
            .config(new RxClient.ClientConfig.Builder().readTimeout(5000, TimeUnit.MILLISECONDS).build())
            .withSslEngineFactory(new ClientSslFactory(SSLContext.getDefault())).build();
}

/**
 * Configurator so that we can support setting the "Accept-Encoding: gzip, deflate" header.
 */
private PipelineConfigurator<HttpClientResponse<ByteBuf>, HttpClientRequest<ByteBuf>> gzipPipelineConfigurator = new PipelineConfigurator<HttpClientResponse<ByteBuf>, HttpClientRequest<ByteBuf>>() {
    public void configureNewPipeline(final ChannelPipeline pipeline) {
        final ChannelHandler handlers = new HttpContentDecompressor();
        pipeline.addLast(handlers);
    }
};

public Observable<Node> xmlWithStatus(final String request, final String uri, final String soapNS) {
    HttpClientRequest<ByteBuf> clientReq = HttpClientRequest.createPost(uri)
            .withHeader("Accept-Encoding", "gzip, deflate").withHeader("Content-Type", "text/xml;charset=UTF-8")
            .withHeader("SOAPAction", soapNS)
            .withHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE).withContent(request);
    return httpClient.submit(clientReq).timeout(5000, TimeUnit.MILLISECONDS).doOnError(error -> {
        System.out.println(error);
    }).flatMap(ResponseHelper.readEntireResponse).doOnError(error -> {
        System.out.println(error);
    }).map(p -> {
        if (p.getLeft().intValue() != 200) {
            throwChassisException(null);
        }
        return toXml(p.getRight());
    });
}

public void shutdown() {
    if (httpClient != null) {
        httpClient.shutdown();
    }
}
@JanakiramanChandrasekran JanakiramanChandrasekran changed the title Spike in Response times Spike in Response times : Rxnetty 0.4.x Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant