[SERVER-4258] v8: switch to Isolates to enable JS multi-threading Created: 11/Nov/11  Updated: 11/Jul/16  Resolved: 22/Dec/11

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: None
Fix Version/s: 2.1.0

Type: Improvement Priority: Major - P3
Reporter: Antoine Girbal Assignee: Antoine Girbal
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 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.



 Comments   
Comment by Eric Milkie [ 21/Nov/12 ]

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.

Comment by Guido Serra [ 21/Nov/12 ]

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 ?

Comment by auto [ 29/Dec/11 ]

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

Comment by Antoine Girbal [ 22/Dec/11 ]

regular tests are passing, parallelTests have passed several times.

Comment by auto [ 15/Nov/11 ]

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

Comment by auto [ 15/Nov/11 ]

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

Comment by Antoine Girbal [ 11/Nov/11 ]

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.

Generated at Thu Feb 08 03:05:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.