简体   繁体   English

Gtw TCP与HTTP负载均衡器之间的区别

[英]Difference btw Gcloud TCP vs HTTP load balancer

I have a jersey app running using embedded Jetty server, in GCE instances, fronted by load balancer. 在GCE实例中,我有一个使用嵌入式Jetty服务器运行的jersey应用程序,并带有负载均衡器。 I load tested the setup with TCP load balancer, I'm able to get around 2400 QPS with under 20ms latency. 我使用TCP负载平衡器对设置进行了负载测试,我能够以不到20ms的延迟获得大约2400 QPS。 But the same set up with HTTP load balancer I'm only able to get around < 1000 QPS with latency under 20ms. 但是,使用HTTP负载平衡器进行的相同设置只能使延迟小于20ms的情况下达到<1000 QPS。

When debugging I noticed there are a lot more opened file descriptors when using HTTP LB. 调试时,我注意到使用HTTP LB时有更多打开的文件描述符。

Following is my embedded jetty config, any ideas would be great! 以下是我的嵌入式码头配置,任何想法都很棒! :) :)

    int httpPort = 8080;
    int maxThreads = 1024;
    int minThreads = 32;
    int idleTimeout = 500;
    QueuedThreadPool pool = new QueuedThreadPool(maxThreads, minThreads, idleTimeout, new java.util.concurrent.ArrayBlockingQueue(6000));

    Server server = new Server(pool);
    ServerConnector httpConnector = new ServerConnector(server);
    httpConnector.setPort(httpPort);
    server.addConnector(httpConnector);

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);

Turns out this fixes the issue: 原来这解决了这个问题:

httpConnector.setIdleTimeout(100L);

Although I'm not sure why with gcloud TCP load balancer that's not an issue yet. 尽管我不确定为什么使用gcloud TCP负载均衡器这还不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM