close_waits with apache reverse proxy from AMQ and websockets











up vote
0
down vote

favorite












We've been drumming the woodwork for a solution to a problem we're having on a server hosting an apache (it has to be apache) reverse proxy. I'm posting this in hopes something jumps out we haven't thought to check yet.



It's re a Spring boot application using a Zuul gateway in front of microservices, and a legacy Spring MVC app upgraded to run with Spring boot libraries. When a change happens on the legacy app, a route is called on an entity service and AMQ is used to send an mqtt message telling the new app to check the state of the MS sql server database and update a web display driven by Ember. All this runs through 2 apache reverse proxies. The first of the two is where the problems occur.



Client (C) -> Reverse Proxy 1 (RP1) -> Reverse Proxy 2(RP2) -> Service (S)
C: running on Ember.js framework, with ember-paho-mqtt library


It works fine in local dev, but when deployed to windows staging servers the app fails after a few minutes, and then netstat shows a flurry of close_wait states that don't go away, on the server hosting the apache reverse proxy. We believe those follow the failure rather than cause it, but that something might be exhausting some thread pool, maybe that used by apache -- like clients trying to connect unnecessarily? But the close_waits happen when the server has got a message telling it to close a connection, has finished working through any data in process, but hasn't heard back from the client telling it to finish the job, right?



The web UIs fail, but existing connections continue to work when tested more directly and sometimes the system recovers eventually, sometimes not.



The legacy app is deployed to JBoss, the microservices to RedHat tomcat servers.



We also use an azure cloud service as part of a complex oauth2 authorization process.



I'm part of a team and only peripherally involved in the project, mainly re the aforementioned legacy app. We believe the problems occur when the legacy app data is changed and the message goes to the spring boot microservices and that the culprit somehow has to do with websockets. But my understanding of the architecture is vaguer than I'd like, sorry about that.



We do have some existing theories. A couple of years ago I worked on a Netty network application in 'nix, and had a bunch of close_waits I was able to prevent by setting thread limits in Java. AMQ uses Netty under the hood, so one option might be to swap it out and put in RabbitMQ instead. We use Paho for mqtt and have looked hard at how to make sure it closes connections. I've also read websockets.io can cause such problems and that substituting SockJS which is simpler can help. We've tried setting and undoing various timeouts/keepalives without success. We've read there's a thread limitation on Apache the way we've probably got it configured, but that increasing it can make things worse by risking thrashing from memory swapping.



So we're clutching at straws, and would welcome any lifelines thrown our way. I'll do my best to provide more info to interested parties.










share|improve this question


























    up vote
    0
    down vote

    favorite












    We've been drumming the woodwork for a solution to a problem we're having on a server hosting an apache (it has to be apache) reverse proxy. I'm posting this in hopes something jumps out we haven't thought to check yet.



    It's re a Spring boot application using a Zuul gateway in front of microservices, and a legacy Spring MVC app upgraded to run with Spring boot libraries. When a change happens on the legacy app, a route is called on an entity service and AMQ is used to send an mqtt message telling the new app to check the state of the MS sql server database and update a web display driven by Ember. All this runs through 2 apache reverse proxies. The first of the two is where the problems occur.



    Client (C) -> Reverse Proxy 1 (RP1) -> Reverse Proxy 2(RP2) -> Service (S)
    C: running on Ember.js framework, with ember-paho-mqtt library


    It works fine in local dev, but when deployed to windows staging servers the app fails after a few minutes, and then netstat shows a flurry of close_wait states that don't go away, on the server hosting the apache reverse proxy. We believe those follow the failure rather than cause it, but that something might be exhausting some thread pool, maybe that used by apache -- like clients trying to connect unnecessarily? But the close_waits happen when the server has got a message telling it to close a connection, has finished working through any data in process, but hasn't heard back from the client telling it to finish the job, right?



    The web UIs fail, but existing connections continue to work when tested more directly and sometimes the system recovers eventually, sometimes not.



    The legacy app is deployed to JBoss, the microservices to RedHat tomcat servers.



    We also use an azure cloud service as part of a complex oauth2 authorization process.



    I'm part of a team and only peripherally involved in the project, mainly re the aforementioned legacy app. We believe the problems occur when the legacy app data is changed and the message goes to the spring boot microservices and that the culprit somehow has to do with websockets. But my understanding of the architecture is vaguer than I'd like, sorry about that.



    We do have some existing theories. A couple of years ago I worked on a Netty network application in 'nix, and had a bunch of close_waits I was able to prevent by setting thread limits in Java. AMQ uses Netty under the hood, so one option might be to swap it out and put in RabbitMQ instead. We use Paho for mqtt and have looked hard at how to make sure it closes connections. I've also read websockets.io can cause such problems and that substituting SockJS which is simpler can help. We've tried setting and undoing various timeouts/keepalives without success. We've read there's a thread limitation on Apache the way we've probably got it configured, but that increasing it can make things worse by risking thrashing from memory swapping.



    So we're clutching at straws, and would welcome any lifelines thrown our way. I'll do my best to provide more info to interested parties.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      We've been drumming the woodwork for a solution to a problem we're having on a server hosting an apache (it has to be apache) reverse proxy. I'm posting this in hopes something jumps out we haven't thought to check yet.



      It's re a Spring boot application using a Zuul gateway in front of microservices, and a legacy Spring MVC app upgraded to run with Spring boot libraries. When a change happens on the legacy app, a route is called on an entity service and AMQ is used to send an mqtt message telling the new app to check the state of the MS sql server database and update a web display driven by Ember. All this runs through 2 apache reverse proxies. The first of the two is where the problems occur.



      Client (C) -> Reverse Proxy 1 (RP1) -> Reverse Proxy 2(RP2) -> Service (S)
      C: running on Ember.js framework, with ember-paho-mqtt library


      It works fine in local dev, but when deployed to windows staging servers the app fails after a few minutes, and then netstat shows a flurry of close_wait states that don't go away, on the server hosting the apache reverse proxy. We believe those follow the failure rather than cause it, but that something might be exhausting some thread pool, maybe that used by apache -- like clients trying to connect unnecessarily? But the close_waits happen when the server has got a message telling it to close a connection, has finished working through any data in process, but hasn't heard back from the client telling it to finish the job, right?



      The web UIs fail, but existing connections continue to work when tested more directly and sometimes the system recovers eventually, sometimes not.



      The legacy app is deployed to JBoss, the microservices to RedHat tomcat servers.



      We also use an azure cloud service as part of a complex oauth2 authorization process.



      I'm part of a team and only peripherally involved in the project, mainly re the aforementioned legacy app. We believe the problems occur when the legacy app data is changed and the message goes to the spring boot microservices and that the culprit somehow has to do with websockets. But my understanding of the architecture is vaguer than I'd like, sorry about that.



      We do have some existing theories. A couple of years ago I worked on a Netty network application in 'nix, and had a bunch of close_waits I was able to prevent by setting thread limits in Java. AMQ uses Netty under the hood, so one option might be to swap it out and put in RabbitMQ instead. We use Paho for mqtt and have looked hard at how to make sure it closes connections. I've also read websockets.io can cause such problems and that substituting SockJS which is simpler can help. We've tried setting and undoing various timeouts/keepalives without success. We've read there's a thread limitation on Apache the way we've probably got it configured, but that increasing it can make things worse by risking thrashing from memory swapping.



      So we're clutching at straws, and would welcome any lifelines thrown our way. I'll do my best to provide more info to interested parties.










      share|improve this question













      We've been drumming the woodwork for a solution to a problem we're having on a server hosting an apache (it has to be apache) reverse proxy. I'm posting this in hopes something jumps out we haven't thought to check yet.



      It's re a Spring boot application using a Zuul gateway in front of microservices, and a legacy Spring MVC app upgraded to run with Spring boot libraries. When a change happens on the legacy app, a route is called on an entity service and AMQ is used to send an mqtt message telling the new app to check the state of the MS sql server database and update a web display driven by Ember. All this runs through 2 apache reverse proxies. The first of the two is where the problems occur.



      Client (C) -> Reverse Proxy 1 (RP1) -> Reverse Proxy 2(RP2) -> Service (S)
      C: running on Ember.js framework, with ember-paho-mqtt library


      It works fine in local dev, but when deployed to windows staging servers the app fails after a few minutes, and then netstat shows a flurry of close_wait states that don't go away, on the server hosting the apache reverse proxy. We believe those follow the failure rather than cause it, but that something might be exhausting some thread pool, maybe that used by apache -- like clients trying to connect unnecessarily? But the close_waits happen when the server has got a message telling it to close a connection, has finished working through any data in process, but hasn't heard back from the client telling it to finish the job, right?



      The web UIs fail, but existing connections continue to work when tested more directly and sometimes the system recovers eventually, sometimes not.



      The legacy app is deployed to JBoss, the microservices to RedHat tomcat servers.



      We also use an azure cloud service as part of a complex oauth2 authorization process.



      I'm part of a team and only peripherally involved in the project, mainly re the aforementioned legacy app. We believe the problems occur when the legacy app data is changed and the message goes to the spring boot microservices and that the culprit somehow has to do with websockets. But my understanding of the architecture is vaguer than I'd like, sorry about that.



      We do have some existing theories. A couple of years ago I worked on a Netty network application in 'nix, and had a bunch of close_waits I was able to prevent by setting thread limits in Java. AMQ uses Netty under the hood, so one option might be to swap it out and put in RabbitMQ instead. We use Paho for mqtt and have looked hard at how to make sure it closes connections. I've also read websockets.io can cause such problems and that substituting SockJS which is simpler can help. We've tried setting and undoing various timeouts/keepalives without success. We've read there's a thread limitation on Apache the way we've probably got it configured, but that increasing it can make things worse by risking thrashing from memory swapping.



      So we're clutching at straws, and would welcome any lifelines thrown our way. I'll do my best to provide more info to interested parties.







      apache spring-boot websocket reverse-proxy amq






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 at 22:19









      wial

      12




      12





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290385%2fclose-waits-with-apache-reverse-proxy-from-amq-and-websockets%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290385%2fclose-waits-with-apache-reverse-proxy-from-amq-and-websockets%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?