Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0037919 | Openbravo ERP | A. Platform | public | 2018-02-15 08:54 | 2018-03-05 16:39 |
Reporter | alostale | ||||
Assigned To | alostale | ||||
Priority | normal | Severity | trivial | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | 3.0PR18Q2 | |||
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 | ||||
Additional Information | |||||
Tags | Performance | ||||
Relationships | |||||
Attached Files | ![]() https://issues.openbravo.com/file_download.php?file_id=11585&type=bug ![]() https://issues.openbravo.com/file_download.php?file_id=11586&type=bug | ||||
Issue History | |||||
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 | bug_revision_view_page.php?rev_id=16707#r16707 | ||
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 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|