Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0037919 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Openbravo ERP] A. Platform | trivial | have not tried | 2018-02-15 08:54 | 2018-03-05 16:39 | |||
Reporter | alostale | View Status | public | |||||
Assigned To | alostale | |||||||
Priority | normal | Resolution | fixed | Fixed in Version | 3.0PR18Q2 | |||
Status | closed | Fix in branch | Fixed in SCM revision | ca9d0d95c9b7 | ||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | AugustoMauch | |||||||
OBNetwork customer | No | |||||||
Web browser | ||||||||
Modules | Core | |||||||
Support ticket | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0037919: some contention on session creation, deactivation and check | |||||||
Description | org.openbravo.erpCommon.security.SessionListener keeps a Set of sessions in current node in order to perform checks for CU. All actions in that set need to be synchronized in order to guarantee thread safety. This synchronization in cases of very high concurrency causes some contention, specially if CU is reached and existing sessions need to be checked, which is the most expensive action, in this case session creation and deactivation is contained. | |||||||
Steps To Reproduce | Modify org.openbravo.test.system.Sessions test to generate 10K sessions in 10 threads and execute it. Check it takes around 250s to complete. 0 [main] INFO org.openbravo.test.system.Sessions - Starting 10 threads to create 10000 sessions each 200817 [pool-2-thread-7] INFO org.openbravo.test.system.Sessions - Thread finished in 200480 ms 216782 [pool-2-thread-1] INFO org.openbravo.test.system.Sessions - Thread finished in 216447 ms 217398 [pool-2-thread-9] INFO org.openbravo.test.system.Sessions - Thread finished in 217061 ms 227083 [pool-2-thread-3] INFO org.openbravo.test.system.Sessions - Thread finished in 226746 ms 227770 [pool-2-thread-2] INFO org.openbravo.test.system.Sessions - Thread finished in 227433 ms 230525 [pool-2-thread-6] INFO org.openbravo.test.system.Sessions - Thread finished in 230188 ms 233148 [pool-2-thread-8] INFO org.openbravo.test.system.Sessions - Thread finished in 232811 ms 237709 [pool-2-thread-10] INFO org.openbravo.test.system.Sessions - Thread finished in 237372 ms 247972 [pool-2-thread-4] INFO org.openbravo.test.system.Sessions - Thread finished in 247635 ms 251520 [pool-2-thread-5] INFO org.openbravo.test.system.Sessions - Thread finished in 251183 ms 251603 [main] INFO org.openbravo.test.system.Sessions - All finished in 251269 ms | |||||||
Proposed Solution | Use a set backed from a ConcurrentHashMap so synchronization does not need to be done by external code, which simplifies the code as well as reduces contention limiting it to internal buckets rather than to the whole object. After this change time is reduced to 47s: 0 [main] INFO org.openbravo.test.system.Sessions - Starting 10 threads to create 10000 sessions each 45711 [pool-2-thread-6] INFO org.openbravo.test.system.Sessions - Thread finished in 45363 ms 46570 [pool-2-thread-4] INFO org.openbravo.test.system.Sessions - Thread finished in 46222 ms 46573 [pool-2-thread-1] INFO org.openbravo.test.system.Sessions - Thread finished in 46226 ms 46808 [pool-2-thread-2] INFO org.openbravo.test.system.Sessions - Thread finished in 46460 ms 47108 [pool-2-thread-7] INFO org.openbravo.test.system.Sessions - Thread finished in 46759 ms 47138 [pool-2-thread-8] INFO org.openbravo.test.system.Sessions - Thread finished in 46789 ms 47392 [pool-2-thread-9] INFO org.openbravo.test.system.Sessions - Thread finished in 47043 ms 47473 [pool-2-thread-5] INFO org.openbravo.test.system.Sessions - Thread finished in 47125 ms 47764 [pool-2-thread-10] INFO org.openbravo.test.system.Sessions - Thread finished in 47415 ms 47818 [pool-2-thread-3] INFO org.openbravo.test.system.Sessions - Thread finished in 47470 ms 47833 [main] INFO org.openbravo.test.system.Sessions - All finished in 47486 ms | |||||||
Tags | Performance | |||||||
Attached Files | ![]() ![]() | |||||||
![]() |
|
![]() |
|
(0102437) hgbot (developer) 2018-02-15 14:38 |
Repository: erp/devel/pi Changeset: ca9d0d95c9b718fd01574d9d0c3d659882b31b2e Author: Asier Lostalé <asier.lostale <at> openbravo.com> Date: Thu Feb 15 14:37:32 2018 +0100 URL: http://code.openbravo.com/erp/devel/pi/rev/ca9d0d95c9b718fd01574d9d0c3d659882b31b2e [^] fiexed bug 37919: contention on session creation, deactivation and check Replaced HashSet that required to be externally synchronized with a Set backed with a ConcurrentHashMap which better handles synchronization. --- M src-test/src/org/openbravo/test/system/Sessions.java M src/org/openbravo/erpCommon/security/SessionListener.java --- |
(0102766) hudsonbot (viewer) 2018-02-22 18:19 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/980a6ad5bbf5 [^] Maturity status: Test |
(0102982) AugustoMauch (administrator) 2018-03-05 16:39 |
Code reviewed and verified |
![]() |
|||
Date Modified | Username | Field | Change |
2018-02-15 08:54 | alostale | New Issue | |
2018-02-15 08:54 | alostale | Assigned To | => platform |
2018-02-15 08:54 | alostale | OBNetwork customer | => No |
2018-02-15 08:54 | alostale | Modules | => Core |
2018-02-15 08:54 | alostale | Triggers an Emergency Pack | => No |
2018-02-15 14:30 | alostale | Severity | minor => trivial |
2018-02-15 14:30 | alostale | Summary | contention on session creation, deactivation and check => some contention on session creation, deactivation and check |
2018-02-15 14:30 | alostale | Steps to Reproduce Updated | View Revisions |
2018-02-15 14:30 | alostale | Proposed Solution updated | |
2018-02-15 14:32 | alostale | Proposed Solution updated | |
2018-02-15 14:35 | alostale | File Added: 37919-before.png | |
2018-02-15 14:35 | alostale | File Added: 37919-after.png | |
2018-02-15 14:35 | alostale | Tag Attached: Performance | |
2018-02-15 14:38 | hgbot | Checkin | |
2018-02-15 14:38 | hgbot | Note Added: 0102437 | |
2018-02-15 14:39 | alostale | Assigned To | platform => alostale |
2018-02-15 14:39 | alostale | Status | new => scheduled |
2018-02-15 14:39 | alostale | Status | scheduled => resolved |
2018-02-15 14:39 | alostale | Fixed in SCM revision | => ca9d0d95c9b7 |
2018-02-15 14:39 | alostale | Resolution | open => fixed |
2018-02-15 14:39 | alostale | Review Assigned To | => AugustoMauch |
2018-02-22 18:19 | hudsonbot | Checkin | |
2018-02-22 18:19 | hudsonbot | Note Added: 0102766 | |
2018-03-05 16:39 | AugustoMauch | Note Added: 0102982 | |
2018-03-05 16:39 | AugustoMauch | Status | resolved => closed |
2018-03-05 16:39 | AugustoMauch | Fixed in Version | => 3.0PR18Q2 |
Copyright © 2000 - 2009 MantisBT Group |