Issue2452

classification
Title: Jython locking threads on Java proxy objects (multithreaded performance degradation)
Type: Severity: critical
Components: Core Versions: Jython 2.7
Milestone: Jython 2.7.1
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: darjus Nosy List: darjus, stefan.richthofer
Priority: Keywords:

Created on 2016-01-09.04:50:00 by darjus, last changed 2016-01-10.07:37:22 by darjus.

Messages
msg10610 (view) Author: Darjus Loktevic (darjus) Date: 2016-01-09.04:49:59
I've been playing with some multithreaded code and noticed that it wasn't scaling well at all with many java object access when more threads were added (4 threads enough). After checking with visualvm thread dump it seems that threads were being locked quite often on JyAttribute hasAttr and getAttr.
msg10611 (view) Author: Darjus Loktevic (darjus) Date: 2016-01-09.04:51:06
After checking with Stefan, it seems the problem is that both getAttr and setAttr are "static synchronized", which essentially creates a global lock.
msg10612 (view) Author: Darjus Loktevic (darjus) Date: 2016-01-10.07:37:22
https://github.com/jythontools/jython/commit/645cd9e51c950bee3e3ab5cdb1ae9bb38889c94b
History
Date User Action Args
2016-01-10 07:37:22darjussetstatus: open -> closed
resolution: accepted
messages: + msg10612
milestone: Jython 2.7.1
2016-01-09 12:24:31darjussetnosy: + stefan.richthofer
2016-01-09 04:51:06darjussetmessages: + msg10611
2016-01-09 04:50:00darjuscreate