0 votes
in Javascript API by (220 points)
Hello all,

I am using IBM BPM 7.5.2 version I have one observation while using participantGroups,

When user login time we fetch user role from LDAP using participantGroups.. This group having around 1500 users with different roles.

here i am sharing example

var myPG1= tw.system.org.findParticipantGroupByName("role1");

var allUsers = role1.allUsers;

for (var i=0; i<allUsers.length; i++)

{    log.info(allUsers[i].name);

for this approach it takes more than 2 mintues of time due to this performance got impacted.

Please suggest any better approach other than allUsers method to get length,name details.

2 Answers

0 votes
by (21.5k points)

I see that you have a typo in your code

var myPG1= tw.system.org.findParticipantGroupByName("role1");

var allUsers = myPG1.allUsers;

for (var i=0; i<allUsers.length; i++)

{    log.info(allUsers[i].name);

try a refresh once and time the individual steps which one is taking long time findPG or .allUsers also time the refresh also, idea being you may need to call refresh only once and caching should happen after that, I remember we had a situation where calling the refresh on a scheduled basis though a timer UCA helped.

0 votes
by (2.3k points)
My first question would be why you are doing this manually as group refresh is one of the actions that happens upon valid login of the user as part of the what the product simply does for you, so iterating over the users doesn't seem to server a purpose.

The second thing I would note is that due to the nature of the JS engine destructively processing large arrays shows significant performance gains over the use of iterators, assuming you don't need the array after processing is done.  So if you change your for loop to -





for large arrays is will run faster.  (check the syntax though, can't remember if the exact call to remove an item from an array.

Related questions

0 votes
1 answer 137 views
0 votes
0 answers 688 views
0 votes
0 answers 92 views
0 votes
0 answers 232 views
0 votes
1 answer 93 views
0 votes
1 answer 166 views
0 votes
1 answer 386 views
0 votes
1 answer 187 views
0 votes
0 answers 53 views
0 votes
1 answer 87 views

599 questions

489 answers


1.8k users

Dosvak IBM BPM /BAW Products, Download Evaluation
Process & Performance Tools Process & Performance Tools
Code Analyzer Code Analyzer
UI Toolkit UI Toolkit
Integration Monitoring Integration Monitoring
Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel