When does arangodb's foxx collects garbage?












4















What I understand is;




  • Foxx is based on V8 Engine.

  • Foxx is multi-threaded, and it doesn't share state with other threads

  • Foxx's thread will quit (is this the right term?) as soon as it sends the response to client.


Aside from V8 Engine's garbage collection, does it mean that any memory used by foxx is garbage collected as soon as the response is made?

If above question's answer is yes, is there a way to disable V8 Engine's garbage collector, and if I disable V8 Engine's GC, can I expect a better latency?



Please let me know if I'm getting it wrong.










share|improve this question





























    4















    What I understand is;




    • Foxx is based on V8 Engine.

    • Foxx is multi-threaded, and it doesn't share state with other threads

    • Foxx's thread will quit (is this the right term?) as soon as it sends the response to client.


    Aside from V8 Engine's garbage collection, does it mean that any memory used by foxx is garbage collected as soon as the response is made?

    If above question's answer is yes, is there a way to disable V8 Engine's garbage collector, and if I disable V8 Engine's GC, can I expect a better latency?



    Please let me know if I'm getting it wrong.










    share|improve this question



























      4












      4








      4








      What I understand is;




      • Foxx is based on V8 Engine.

      • Foxx is multi-threaded, and it doesn't share state with other threads

      • Foxx's thread will quit (is this the right term?) as soon as it sends the response to client.


      Aside from V8 Engine's garbage collection, does it mean that any memory used by foxx is garbage collected as soon as the response is made?

      If above question's answer is yes, is there a way to disable V8 Engine's garbage collector, and if I disable V8 Engine's GC, can I expect a better latency?



      Please let me know if I'm getting it wrong.










      share|improve this question
















      What I understand is;




      • Foxx is based on V8 Engine.

      • Foxx is multi-threaded, and it doesn't share state with other threads

      • Foxx's thread will quit (is this the right term?) as soon as it sends the response to client.


      Aside from V8 Engine's garbage collection, does it mean that any memory used by foxx is garbage collected as soon as the response is made?

      If above question's answer is yes, is there a way to disable V8 Engine's garbage collector, and if I disable V8 Engine's GC, can I expect a better latency?



      Please let me know if I'm getting it wrong.







      arangodb foxx






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 13:49









      Ken White

      107k11153315




      107k11153315










      asked Nov 13 '18 at 13:45









      HelloWorldHelloWorld

      88110




      88110
























          1 Answer
          1






          active

          oldest

          votes


















          4














          In contrast to many other interpreters, javascript interpreters have a special feature. They need to be run for several browser windows, and one Window shouldn't know about the other.



          Thus the interpreters operation set is strictly separated from its general logic. In
          V8 this concept is implemented under the name Isolate.



          ArangoDB spawns several Isolates, each one context that Foxx can run in. ArangoDBs infrastructure has hooks into the Isolates that can signal i.e. new collections are available. However, there is no such hook that could be used in Foxx.



          ArangoDB is multi-threaded. The request-broker will read the request, and if it finds out that it should execute a Foxx-Request (instead of i.e. a direct AQL invocation) it will pick one of the Isolates from the pool, and continue execution within that V8 Context. So there is neither a warranty you reach the same worker thread, nor that it will pick the same Isolate on subsequent requests.



          Each of these Isolates can be garbage collected individual, without blocking the execution in other Isolates. ArangoDB Exposes statistics about these contexts , so you can see there that Isolates can be tagged dirty which means they should be garbage collected. You can use require("internal").wait(<seconds>, true) to manually invoke the garbage collection. The number of contexts spawned depends on the numbers of CPUs your system has. However, these settings can be configured. So you see that the tactics are quite different from tuning the Java GC.



          Foxx itself will discard structures allocated by services after the request. They will then be unavailable in subsequent requests, and once the garbage collection runs their memory will be returned to the system.



          Usually you should strive to make your Foxx Services a thin layer around the AQL you execute.
          While performance should be considered as a feature, you usually start looking at it once your code has reached a certain grade of maturity. We explained howto create usage scenarios and measure and optimize possible throughputs in our blog post series; while Foxx services aren't mentioned there directly, the tactics used there can be applied to Foxx as well.






          share|improve this answer


























          • Thank you very much for your answer!

            – HelloWorld
            Nov 14 '18 at 17:10











          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',
          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%2fstackoverflow.com%2fquestions%2f53282419%2fwhen-does-arangodbs-foxx-collects-garbage%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          In contrast to many other interpreters, javascript interpreters have a special feature. They need to be run for several browser windows, and one Window shouldn't know about the other.



          Thus the interpreters operation set is strictly separated from its general logic. In
          V8 this concept is implemented under the name Isolate.



          ArangoDB spawns several Isolates, each one context that Foxx can run in. ArangoDBs infrastructure has hooks into the Isolates that can signal i.e. new collections are available. However, there is no such hook that could be used in Foxx.



          ArangoDB is multi-threaded. The request-broker will read the request, and if it finds out that it should execute a Foxx-Request (instead of i.e. a direct AQL invocation) it will pick one of the Isolates from the pool, and continue execution within that V8 Context. So there is neither a warranty you reach the same worker thread, nor that it will pick the same Isolate on subsequent requests.



          Each of these Isolates can be garbage collected individual, without blocking the execution in other Isolates. ArangoDB Exposes statistics about these contexts , so you can see there that Isolates can be tagged dirty which means they should be garbage collected. You can use require("internal").wait(<seconds>, true) to manually invoke the garbage collection. The number of contexts spawned depends on the numbers of CPUs your system has. However, these settings can be configured. So you see that the tactics are quite different from tuning the Java GC.



          Foxx itself will discard structures allocated by services after the request. They will then be unavailable in subsequent requests, and once the garbage collection runs their memory will be returned to the system.



          Usually you should strive to make your Foxx Services a thin layer around the AQL you execute.
          While performance should be considered as a feature, you usually start looking at it once your code has reached a certain grade of maturity. We explained howto create usage scenarios and measure and optimize possible throughputs in our blog post series; while Foxx services aren't mentioned there directly, the tactics used there can be applied to Foxx as well.






          share|improve this answer


























          • Thank you very much for your answer!

            – HelloWorld
            Nov 14 '18 at 17:10
















          4














          In contrast to many other interpreters, javascript interpreters have a special feature. They need to be run for several browser windows, and one Window shouldn't know about the other.



          Thus the interpreters operation set is strictly separated from its general logic. In
          V8 this concept is implemented under the name Isolate.



          ArangoDB spawns several Isolates, each one context that Foxx can run in. ArangoDBs infrastructure has hooks into the Isolates that can signal i.e. new collections are available. However, there is no such hook that could be used in Foxx.



          ArangoDB is multi-threaded. The request-broker will read the request, and if it finds out that it should execute a Foxx-Request (instead of i.e. a direct AQL invocation) it will pick one of the Isolates from the pool, and continue execution within that V8 Context. So there is neither a warranty you reach the same worker thread, nor that it will pick the same Isolate on subsequent requests.



          Each of these Isolates can be garbage collected individual, without blocking the execution in other Isolates. ArangoDB Exposes statistics about these contexts , so you can see there that Isolates can be tagged dirty which means they should be garbage collected. You can use require("internal").wait(<seconds>, true) to manually invoke the garbage collection. The number of contexts spawned depends on the numbers of CPUs your system has. However, these settings can be configured. So you see that the tactics are quite different from tuning the Java GC.



          Foxx itself will discard structures allocated by services after the request. They will then be unavailable in subsequent requests, and once the garbage collection runs their memory will be returned to the system.



          Usually you should strive to make your Foxx Services a thin layer around the AQL you execute.
          While performance should be considered as a feature, you usually start looking at it once your code has reached a certain grade of maturity. We explained howto create usage scenarios and measure and optimize possible throughputs in our blog post series; while Foxx services aren't mentioned there directly, the tactics used there can be applied to Foxx as well.






          share|improve this answer


























          • Thank you very much for your answer!

            – HelloWorld
            Nov 14 '18 at 17:10














          4












          4








          4







          In contrast to many other interpreters, javascript interpreters have a special feature. They need to be run for several browser windows, and one Window shouldn't know about the other.



          Thus the interpreters operation set is strictly separated from its general logic. In
          V8 this concept is implemented under the name Isolate.



          ArangoDB spawns several Isolates, each one context that Foxx can run in. ArangoDBs infrastructure has hooks into the Isolates that can signal i.e. new collections are available. However, there is no such hook that could be used in Foxx.



          ArangoDB is multi-threaded. The request-broker will read the request, and if it finds out that it should execute a Foxx-Request (instead of i.e. a direct AQL invocation) it will pick one of the Isolates from the pool, and continue execution within that V8 Context. So there is neither a warranty you reach the same worker thread, nor that it will pick the same Isolate on subsequent requests.



          Each of these Isolates can be garbage collected individual, without blocking the execution in other Isolates. ArangoDB Exposes statistics about these contexts , so you can see there that Isolates can be tagged dirty which means they should be garbage collected. You can use require("internal").wait(<seconds>, true) to manually invoke the garbage collection. The number of contexts spawned depends on the numbers of CPUs your system has. However, these settings can be configured. So you see that the tactics are quite different from tuning the Java GC.



          Foxx itself will discard structures allocated by services after the request. They will then be unavailable in subsequent requests, and once the garbage collection runs their memory will be returned to the system.



          Usually you should strive to make your Foxx Services a thin layer around the AQL you execute.
          While performance should be considered as a feature, you usually start looking at it once your code has reached a certain grade of maturity. We explained howto create usage scenarios and measure and optimize possible throughputs in our blog post series; while Foxx services aren't mentioned there directly, the tactics used there can be applied to Foxx as well.






          share|improve this answer















          In contrast to many other interpreters, javascript interpreters have a special feature. They need to be run for several browser windows, and one Window shouldn't know about the other.



          Thus the interpreters operation set is strictly separated from its general logic. In
          V8 this concept is implemented under the name Isolate.



          ArangoDB spawns several Isolates, each one context that Foxx can run in. ArangoDBs infrastructure has hooks into the Isolates that can signal i.e. new collections are available. However, there is no such hook that could be used in Foxx.



          ArangoDB is multi-threaded. The request-broker will read the request, and if it finds out that it should execute a Foxx-Request (instead of i.e. a direct AQL invocation) it will pick one of the Isolates from the pool, and continue execution within that V8 Context. So there is neither a warranty you reach the same worker thread, nor that it will pick the same Isolate on subsequent requests.



          Each of these Isolates can be garbage collected individual, without blocking the execution in other Isolates. ArangoDB Exposes statistics about these contexts , so you can see there that Isolates can be tagged dirty which means they should be garbage collected. You can use require("internal").wait(<seconds>, true) to manually invoke the garbage collection. The number of contexts spawned depends on the numbers of CPUs your system has. However, these settings can be configured. So you see that the tactics are quite different from tuning the Java GC.



          Foxx itself will discard structures allocated by services after the request. They will then be unavailable in subsequent requests, and once the garbage collection runs their memory will be returned to the system.



          Usually you should strive to make your Foxx Services a thin layer around the AQL you execute.
          While performance should be considered as a feature, you usually start looking at it once your code has reached a certain grade of maturity. We explained howto create usage scenarios and measure and optimize possible throughputs in our blog post series; while Foxx services aren't mentioned there directly, the tactics used there can be applied to Foxx as well.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 14 '18 at 10:30

























          answered Nov 14 '18 at 10:18









          dothebartdothebart

          4,869829




          4,869829













          • Thank you very much for your answer!

            – HelloWorld
            Nov 14 '18 at 17:10



















          • Thank you very much for your answer!

            – HelloWorld
            Nov 14 '18 at 17:10

















          Thank you very much for your answer!

          – HelloWorld
          Nov 14 '18 at 17:10





          Thank you very much for your answer!

          – HelloWorld
          Nov 14 '18 at 17:10


















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282419%2fwhen-does-arangodbs-foxx-collects-garbage%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

          Bressuire

          Vorschmack

          Quarantine