Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4258

v8: switch to Isolates to enable JS multi-threading

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.0
    • Component/s: JavaScript
    • Labels:
      None

      Description

      Right now v8 using a single (implicit) Isolate.
      Preemption is possible but still only 1 thread can execute at a time.
      Also we added our own mutex to prevent preemption.

      Switching to Isolates and removing the mutex would allow full multithreading.

        Activity

        Hide
        antoine Antoine Girbal (Inactive) added a comment -

        this was implemented as part of SERVER-4191 fix.
        Diff is fairly small 49c58aa9baccde3ac82ed82f9c5c29286d2a2889
        verified that when starting 2 jobs with busy loops, 200% cpu is used.

        From what I see, mutex was only protecting the global interrupt map.
        It now gets its own mutex, and rest of execution is not protected by mutex anymore.

        Show
        antoine Antoine Girbal (Inactive) added a comment - this was implemented as part of SERVER-4191 fix. Diff is fairly small 49c58aa9baccde3ac82ed82f9c5c29286d2a2889 verified that when starting 2 jobs with busy loops, 200% cpu is used. From what I see, mutex was only protecting the global interrupt map. It now gets its own mutex, and rest of execution is not protected by mutex anymore.
        Hide
        auto auto (Inactive) added a comment -

        Author:

        {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

        Message: SERVER-4258: dont need lock preemption with isolates
        Branch: master
        https://github.com/mongodb/mongo/commit/de2ab329d4c6d16db4d18fbf0e0c24f56d25c054

        Show
        auto auto (Inactive) added a comment - Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'} Message: SERVER-4258 : dont need lock preemption with isolates Branch: master https://github.com/mongodb/mongo/commit/de2ab329d4c6d16db4d18fbf0e0c24f56d25c054
        Hide
        auto auto (Inactive) added a comment -

        Author:

        {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

        Message: SERVER-4258: switch the JS Thread classes to work with v8 isolate
        Branch: master
        https://github.com/mongodb/mongo/commit/e11df372b0b63187f1feb8ae1339d934b4a0ecb8

        Show
        auto auto (Inactive) added a comment - Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'} Message: SERVER-4258 : switch the JS Thread classes to work with v8 isolate Branch: master https://github.com/mongodb/mongo/commit/e11df372b0b63187f1feb8ae1339d934b4a0ecb8
        Hide
        antoine Antoine Girbal (Inactive) added a comment -

        regular tests are passing, parallelTests have passed several times.

        Show
        antoine Antoine Girbal (Inactive) added a comment - regular tests are passing, parallelTests have passed several times.
        Hide
        auto auto (Inactive) added a comment -

        Author:

        {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

        Message: SERVER-4258: no more locking needed for native execution. Test to check multithreading.
        Branch: master
        https://github.com/mongodb/mongo/commit/a71bda30078c262667ccdb8bb97fe3add24a2afb

        Show
        auto auto (Inactive) added a comment - Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'} Message: SERVER-4258 : no more locking needed for native execution. Test to check multithreading. Branch: master https://github.com/mongodb/mongo/commit/a71bda30078c262667ccdb8bb97fe3add24a2afb
        Hide
        zeph Guido Serra added a comment - - edited

        hi guys, this ticket in mentioned as "coming!" in the documentation at http://www.mongodb.org/display/DOCS/How+does+concurrency+work > JavaScript

        but seems pretty "Closed" to me... isn't it? shall I take advantage of it with an "enabling flag" in my queries, or is working by default giving me full access to all cpu cores for parallel threading/computation? or do I STILL get isolated/serialized to one ?

        Show
        zeph Guido Serra added a comment - - edited hi guys, this ticket in mentioned as "coming!" in the documentation at http://www.mongodb.org/display/DOCS/How+does+concurrency+work > JavaScript but seems pretty "Closed" to me... isn't it? shall I take advantage of it with an "enabling flag" in my queries, or is working by default giving me full access to all cpu cores for parallel threading/computation? or do I STILL get isolated/serialized to one ?
        Hide
        milkie Eric Milkie added a comment -

        There are some issues with V8 that will be fixed for the upcoming 2.4 release. I can't recommend running server version 2.2 with V8 at this time. When 2.4 comes out, there will no longer be one mutex around the JS interpreter in the server.

        Show
        milkie Eric Milkie added a comment - There are some issues with V8 that will be fixed for the upcoming 2.4 release. I can't recommend running server version 2.2 with V8 at this time. When 2.4 comes out, there will no longer be one mutex around the JS interpreter in the server.

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since reply:
              2 years, 32 weeks, 2 days ago
              Date of 1st Reply: