Write on sockets blocking for long periods of time on writes












0















Here is the scenario where i am seeing writes on TCP sockets getting blocked for long periods of time




  1. Client (curl) is downloading a large file at slow speed, I can reproduce this by using curl --limit-rate 1k option


  2. Server (running on Ubuntu 16.04.5 LTS) does writes on socket in a loop


  3. In tcp-dump traces, I do see that TCP window of client becomes zero and server is sending ~ 1 KB data/ sec


  4. The writes blocks for ~ 60 seconds and then allows writes of abt 60 K in burst and then blocks again for 60+ seconds


  5. Assuming that send buffer is of fixed size, I would have assumed that writes would block for 1 second and allow write of 1k and then again block for 1 secs , i.e. allow write of 1k every second instead of 60+k every 60 seconds in bursts



Does any one know the reasoning on why i am seeing this behavior? I can see this behavior by looking at strace output










share|improve this question



























    0















    Here is the scenario where i am seeing writes on TCP sockets getting blocked for long periods of time




    1. Client (curl) is downloading a large file at slow speed, I can reproduce this by using curl --limit-rate 1k option


    2. Server (running on Ubuntu 16.04.5 LTS) does writes on socket in a loop


    3. In tcp-dump traces, I do see that TCP window of client becomes zero and server is sending ~ 1 KB data/ sec


    4. The writes blocks for ~ 60 seconds and then allows writes of abt 60 K in burst and then blocks again for 60+ seconds


    5. Assuming that send buffer is of fixed size, I would have assumed that writes would block for 1 second and allow write of 1k and then again block for 1 secs , i.e. allow write of 1k every second instead of 60+k every 60 seconds in bursts



    Does any one know the reasoning on why i am seeing this behavior? I can see this behavior by looking at strace output










    share|improve this question

























      0












      0








      0








      Here is the scenario where i am seeing writes on TCP sockets getting blocked for long periods of time




      1. Client (curl) is downloading a large file at slow speed, I can reproduce this by using curl --limit-rate 1k option


      2. Server (running on Ubuntu 16.04.5 LTS) does writes on socket in a loop


      3. In tcp-dump traces, I do see that TCP window of client becomes zero and server is sending ~ 1 KB data/ sec


      4. The writes blocks for ~ 60 seconds and then allows writes of abt 60 K in burst and then blocks again for 60+ seconds


      5. Assuming that send buffer is of fixed size, I would have assumed that writes would block for 1 second and allow write of 1k and then again block for 1 secs , i.e. allow write of 1k every second instead of 60+k every 60 seconds in bursts



      Does any one know the reasoning on why i am seeing this behavior? I can see this behavior by looking at strace output










      share|improve this question














      Here is the scenario where i am seeing writes on TCP sockets getting blocked for long periods of time




      1. Client (curl) is downloading a large file at slow speed, I can reproduce this by using curl --limit-rate 1k option


      2. Server (running on Ubuntu 16.04.5 LTS) does writes on socket in a loop


      3. In tcp-dump traces, I do see that TCP window of client becomes zero and server is sending ~ 1 KB data/ sec


      4. The writes blocks for ~ 60 seconds and then allows writes of abt 60 K in burst and then blocks again for 60+ seconds


      5. Assuming that send buffer is of fixed size, I would have assumed that writes would block for 1 second and allow write of 1k and then again block for 1 secs , i.e. allow write of 1k every second instead of 60+k every 60 seconds in bursts



      Does any one know the reasoning on why i am seeing this behavior? I can see this behavior by looking at strace output







      networking






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 21 at 18:11









      Harish RawatHarish Rawat

      11




      11






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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',
          autoActivateHeartbeat: false,
          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%2faskubuntu.com%2fquestions%2f1111725%2fwrite-on-sockets-blocking-for-long-periods-of-time-on-writes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1111725%2fwrite-on-sockets-blocking-for-long-periods-of-time-on-writes%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

          Human spaceflight

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

          張江高科駅