Wednesday, June 24, 2015

Authorization Error while doing offline deployment in IBM BPM PS

Problem :: Facing Error while doing offline deployment in IBM BPM PS servers. Error is 'You are not authorized to make changes to items in this context'.

We were doing offline deployment with very well established commands and commands which we use in other environments and working from long time.


Work Around ::
We raised PMR for same and  after some investigation IBM team came back with details that there was problem in Database an entry for particular application and authorization.  
Table - LSW_ACL_ENTRY
We need to check the entry for our project in this table which we can do by comparing below columns
LSW_ACL_ENTRY -> PO_ID
LSW_PROJECT     -> Project_Id

And then check what is the User_id or group_id in the respective column of LSW_ACL_ENTRY. in our case user_id was 1 which means tw_autor user was having access to that processApp.

IBM team was not sure why it was like that as it should be user_id 3 which is tw_admin who should have access to application.

Now, catch is we were using tw_admin credentials to login to wsadmin console before doing deployment. and this user was not having access to application. at same time we cannot do deployment using tw_author as it is not an admin user.

As a workaround , We have added tw_author user in tw_admins group and completed our deployment using tw_author user which worked.

IBM Team is still not sure why this thing happened and they said they will investigate and come back with permanent solution as adding tw_author in tw_admins group is not a good idea.

I will update this post if we find any permanent solution.

Monday, June 1, 2015

IBM BPM PC servre throwing OOM error and High CPU usage after 7.5.1.2 upgrade from 7.5.1.1

Problem::
Getting OutofMemory error and High CPU usage of applicaiton server just after upgrading to IBM BPM 7.5.1.2
We have raised PMR to IBM for same and solution we got was as below.

Solution ::
After upgrading BPM 7.5.1.1 to 7.5.1.2 all snapshots will be some kind 
of 'fixed'. Hence, those are loaded in the heap and could allocate a   
lot of memory, depending on the amount. This operation is called       
UserAttributeDefinitionRepair and is an one time operation. So when it 
is completed once, it is not executed again. If the system crashes     
during this operation, BPM tries to re-run it again and will probably  
fail again.                                                            
                                                                        
One can verify, that this process is running, doing the following: To  
check if the 'UserAttributeDefinitionRepair' is still running, please  
check table LSW_SYSTEM and look for the PROPKEY                        
'UserAttributeDefinitionRepair'. If its PROPVALUE is not COMPLETED,    
than the process is not finished yet.                                  
                                                                        
In order to regulate the number of loaded snapshots one can adjust the 
Branch Context Cache Size. We suggested to use the following action    
plan:                                                                  
                                                                        
1) Change the branch-context-max-cache-size to 64 and monitor the      
system, if OOM occurs (testing now)                                    
2) Change the branch-context-max-cache-size to 32 and monitor the      
system, if OOM occurs,                                                 
3) Install the recommended fixes for BPMSnapshotCleanup and dependency 
ifixes on top of 7.5.1.2.                                              
 - 7512 tab                                                             
4) Run BPMSnapshotCleanup command as instructed to clean up unneeded   
 snapshots.                                                            
main.doc/managinglib/topic/managing_snapshots_i.html?cp=SSFPJS_7.5.1   
5) After clean up database, start server and monitor the system.       
                                                                        
Steps 1 and 2 might be the most crucial. Reducing the cache size causes
to be not that much Snapshots be loaded in the heap at once. As a      
result, the whole process will take longer, but it will also not fail. 
This value can be adjusted after the process is once finished (see     
above: PROPVALUE shows COMPLETED then).                                
                                                                        
Steps 3 to 5 are recommended in order to remove old, unused snapshots, 
that influence the whole process. Keeping the system clean is a good   
approach in general. Those cleaning operations are just available on   
BPM 7.5.1.2 and not 7.5.1.1. See:                                      
ofmemory-regarding-poversions/                                         
                                                                        
In order to prevent the whole problem, you can use the following       
process for further migrations from BPM 7.5.1.1 to BPM 7.5.1.2:        
                                                                        
1) Identify the process apps and toolkits which have the largest numbers
of snapshots by running DB queries. Take note.                         
2) Repeat the following steps to each process app or toolkit will be   
 cleaned.                                                              
    a) Create a new snapshot;                                          
    b) Export snapshot created in a);                                   
    c) Archive and delete process app or toolkit;                      
    d) Re-import snapshot exported in b).                              
                                                                        
    Note: If multiple versions of toolkit snapshots are referenced,    
please do the following:                                               
    a1) Export all toolkit snapshots to keep one by one;               
    b1) Archive and delete the toolkit;                                 
    c1) Import toolkit snapshot in the desired sequence, import the    
oldest snapshot first. Do NOT import them with dependent process apps  
since it may potentially messed up the toolkit snapshot levels.         

Thursday, May 28, 2015

All you want to know about IBM BPM Event Manager - Performance tuning


If anything most irritating in IBM BPM product is its lake of documentation of user manual for the product. I have spend long time on finding information about different component of IBM BPM and believe me its bit tough to find good article or manual. 

Yesterday, I found a very good article on IBM BPM Event Manager by BP3 and it has almost everything we want to know about IBM BPM Event Manager.

Which includes topics like below.

Event Manager Design

In the Event Manager (EM) design the database the master of everything.
The important Event Manager related table in BPMDB are:
lsw_em_instance - A row for each EM scheduler.
lsw_em_task - A row for each non-completed task, includes a reference to lsw_em_instance to indicate which scheduler owns each task.
lsw_em_task_keyword - One-to-many table mapping a task to its associated keywords
lsw_em_sync_queue - A row for each sync queue, includes a reference to lsw_em_instance to indicate which scheduler owns each sync queue.
lsw_uca_blackout - A row for each blackout period, including the next transitions into and out of blackout
The database knows what schedulers exist, what sync queues exist, what tasks exist, what states the tasks are in, etc. So, basically Event Manager uses the database’s transaction guarantees as much as possible to ensure a consistent view across all machines in a cluster. In addition, Event Manager uses the database’s system clock as the master, to avoid problems with time-syncing among machines in a cluster.
You can find full Article at below link which is very informative and intresting. 

Saturday, May 23, 2015

what to do when a Service or BPD in loop in IBM BPM and kill process does not work

Question

During testing and development, a business process definition or service might accidentally enter into an infinite loop. What is the procedure to clean up these unnecessary instances and tasks and stop the looping?

Cause

IBM Business Process Manager is a development platform and has many of the same programming structures and features that are found in traditional programming, such as looping, recursion, and so on. Looping on a service or business process definition is possible. As with any looping event, an exit condition must exist. Sometimes during development or production runtime, an infinite loop can occur.
IBM Business Process Manager has a component called the Event Manager. The Event Manager moves tokens in the business process definition engine and the service engine. The Event Manager continues to process a looping event until the event manager is stopped or the loop stops.

Answer

http://www-01.ibm.com/support/docview.wss?uid=swg21622584

Monday, April 20, 2015

Newly Created groups in LDAP not visible in BPM - About User/Gorup sync from LDAP (External Repository) to BPM

If you have configured IBM Business Process Manager to work with an external security provider, you can use the Process Admin Console to synchronize external users and groups.

If you have created new User or Group in LDAP or done User-Group Mapping and it is not reflected in IBM BPM, you can follow below steps.
  • Ask the newly created user or any user in the newly created or change group to log into BPM server, This will refresh the mapping and all data should be there again.
  • Can do manula user sync from ProcessAdmin Console -> User Management.
  • If above steps doesnt work, restart the servers.
If problem is still not solved, follow below articles(links at end of this post) which explains few more steps.
IBM Business Process Manager synchronizes external users and groups based on the following triggers:
  • Upon startup of a cluster member or server, all available groups (without members) are synchronized, so that all external groups that are available for modeling in the Process Designer repository are available for assignment in the Process Admin Console.
  • When a user logs in to Process Portal for the first time, that user is created with the IBM Business Process Manager database.
  • When a new or existing user logs in to Process Portal, that member's group memberships are updated. The groups the user is in are queried from the external user registry and the IBM Business Process Manager database content is updated to reflect the current state.
  • When a REST call is triggered because a user that was newly registered in a federated repository (using an LDAP server) is not yet known to IBM Business Process Manager, synchronization of external users and groups with IBM Business Process Manager takes place. This synchronization is done only once.

Thursday, March 19, 2015

IBM BPM Event Manager

The main function of the Event Manager is to guarantee scheduled execution of code. Thing to remember over here is that the Event Manager is not executing the code, but scheduling it with the corresponding Process Server. Any work scheduled by a specific Event Manager is run on the local Process Server. The Event Manager scheduler is used anytime an undercover agent (UCA) is invoked, but is also used for processing business process definitions (BPD) notifications, executing business process definition system lane activities, and executing business process definition timer events - it is not specific to TWEvents or to undercover agents.

All date times in the process database are written by the database and use the database servers’ time clock. All timer based executions (BPD timers, scheduled UCAs, task due dates are all triggered and alerted by the process server. The time clocks of the TeamWorks server and the database need to be in sync or events will not be processed properly.


Queues ::
First we need to understand Queues in order to understand Event Manager.
IBM BPM has two type of queue – Asynchronous (async) and Synchronous (sync). The Event Manager treats sync and async queues differently.

1.)    Sync Queues ::
Sync queues are executed serially. If you have multiple tasks set to run on one sync queue, they will execute one after the other in the order that they were put into the sync queue.
Each task in a sync queue must be executed in serial. To prevent problems in a cluster, an Event Manager claims ownership of one or more sync queues when it starts up. The ownership is stored in the LSW_UCA_SYNC_QUEUE where QUEUE_OWNER is linked to OWNER_ID in LSW_EM_INSTANCE.This is not a permanent assignment. The LSW_EM_INSTANCE table keeps track of status of all of the event managers. The status is checked every 15 seconds. If the owner of a sync queue is no longer available, another Event Manager takes ownership of that sync queue

2.)    Async Queues ::
Async queues are executed as soon as possible with no guaranteed order.
Async tasks are picked up by each Event Manager when there is room in their async queue for more tasks.





80EventManager.xml ::
Each process server has its own running Event Manager. The Event Manager is configured by each process server's copy of the 80EventManager.xml file:

Configuring Event Manager using 80EventManager.xml file
<enable>true</enable>
If this parameter set to true, the Event Manager is turned on for this process server instance. If you set this parameter to off, this process server has no event manager. Setting this parameter to false also disables the business process definition engine for this instance. This approach allows you to allocate process server instances for different duties. 

<start-paused>false</start-paused>
If this parameter is set to true, the scheduler for the Event Manager is started in a paused state. The Event Manager scheduler resumes if you specifically tell it to resume from the Event Manager Monitor console page, or if you click Resume All on that page.
Note: Pause/Resume always uses the Java Message Service (JMS) to send the request to the scheduler, even if you are pausing or resuming the web server to which you are connected. Pause/Resume is the only piece of the scheduler infrastructure that uses JMS - all other communication is done through the database.

<name>machine name</name>
This parameter is commented out, by default, and the host name is used instead. This parameter is used to populate the LSW_EM_INSTANCE table and names the Event Manager as viewed from the Event Manager monitor. If your host name is not descriptive for you, you can uncomment this parameter and use a name of your choosing. 

<heartbeat-period>15000</heartbeat-period>
<heartbeat-expiration>60000</heartbeat-expiration>
These parameters are used to determine which Event Manager instances are up and running. These parameters should not need to be changed.
The heartbeat is a separate thread that constantly updates the lsw_em_instance database table to tell other schedulers that it is alive. The heartbeat runs even if the scheduler itself is paused. The lsw_em_instance table drives the content in the top section of the Event Manager Monitor console. A scheduler whose expiration time is in the past is treated as disconnected. When this situation happens, the other schedulers assume that it is dead and pick ups any additional work as necessary. The heartbeat of a non-disabled scheduler will update the lsw_em_instance every <heartbeat-period> milliseconds (15 sec by default), and it sets its expiration to <heartbeat-expiration> milliseconds in the future (60 sec by default). This situation means that if a process server machine gets completely unplugged, it will take 60 seconds until the other schedulers recognize it as disconnected.

<loader-long-period>15000</loader-long-period>
For every loader long period, the Event Manager looks at each queue (sync and async) that it has access to and fills them to capacity. This scenario is sometimes referred to as a major tick.

<loader-short-period>2000</loader-short-period>
For every loader short period, the Event Manager looks through each of the queues that the Event Manager has and tries to fill them to capacity. Think of the loader long period as a sweep that fills the queue and the short period as the sweep that tries to fill any space that might be left over in the queue. This scenario is sometimes referred to as a minor tick.

<loader-advance-window>60000</loader-advance-window>
For scheduled tasks, this parameter specifies how far in advance the Event Manager looks for tasks.

<sync-queue-capacity>10</sync-queue-capacity>
This parameter specifies the number of tasks to fill for each sync queue that the Event Manager has acquired.

<async-queue-capacity>10</async-queue-capacity>
This parameter specifies the number of tasks to fill for each async queue that the Event Manager has acquired.

<bpd-queue-capacity>20</bpd-queue-capacity>
Business process definitions execute in their own async queue. The business process definition queue is used for timers firing, delivering messages to business process definition instances, and executing system lane tasks. This parameter is the queue depth for that queue.

<system-queue-capacity>10</system-queue-capacity>
The Event Manager has its own internal queue. This parameter is barely used and should not need to be changed.

<min-thread-pool-size>5</min-thread-pool-size>
This parameter specifies the minimum number of threads that the Event Manager should use.

<max-thread-pool-size>50</max-thread-pool-size>
This parameter specifies the maximum number of threads that the Event Manager can use.

The thread pool is not per queue; it is the total number of threads for that Event Manager instance in that particular Process Server Java virtual machine (JVM).
Note: Your total available database connections in the application server connection pool should be at least 2x this number. The number of connections on the actual database server needs to be at least the sum of the max connection pool for all nodes in the cluster.

<re-execute-limit>5</re-execute-limit>
This parameter specifies the maximum number of times to retry a failed task.

<kick-on-schedule>true</kick-on-schedule>
When this parameter is set to true, a newly-scheduled task forces the Event Manager into an immediate poll of lsw_em_task, to reduce the time between when a new task is scheduled and when it will be executed. This parameter helps with latency - a newly-scheduled "right now" task is executed almost immediately - but hurts overall throughput, because the TaskLoader ends up being more active than it would be otherwise. If the kick-on-schedule is false, newly-scheduled tasks are not picked up until the next time the Event Manager polls lsw_em_task (up to the loader-long-period), which will increase latency. However it also increases overall throughput by reducing the chatter and contention on the lsw_em_task table for a system with heavily loaded Event Manager, this parameter should be set to false.

<event-retry-interval>5000</event-retry-interval>
This parameter specifies the time between retries for failed tasks.

<task-execution-listener>com.lombardisoftware.server.scheduler.DbTaskExecutionListener</task-execution-listener>
This parameter is disabled by default. If the parameter is enabled, task history is maintained in the lsw_em_task_history table. You can then query this table to get the history of your tasks. Note: The product does not provide a way to display or clean up this data.

<sync-queue-controller-interval>5000</sync-queue-controller-interval>
This parameter specifies the time interval (milliseconds) the Sync Queue Controller wakes up and checks for Sync Queue jobs that need to be executed

Removing a stuck task -
Because sync queues only advance when a task completes, a poorly designed task can cause a sync queue to stop. If you do need to stop one, you can delete the task from the lsw_em_task table. You can then stop and start the Event Manager from the console to get things moving again.

Points to remember -
·         The Event Manager is quick and efficient. Usually it is the tasks it is executing that slows it down; not the Event Manager itself.
·         If you want to throttle the Event Manager, do not decrease the thread pool. Instead, decrease the queue capacity.
·         A sync queue can get stuck because it will not advance until the task completes. To help make this less of a problem, create multiple sync queues. You can manage sync queues in the Teamworks console.
·         All the time stamps used by the Event Manager scheduler - the heartbeat expirations and the task scheduled times - are interpreted relative to the system clock for the database machine. Thus, the scheduler does not require keeping the process server system clocks in sync. Keeping system clocks in sync is a good idea, however, for date-based tracking data, log analysis, and so on.

·         All time settings mentioned in 80EventManager.xml are in milliseconds.

Tuesday, December 16, 2014

IBM BPM Instrumentation Page - A very good way to Monitor IBM BPM


Instrumentation Explained for IBM BPM.

What is Instrumentation?
How to use Instrumentation?
What all we can monitory using Instrumentation?

If you have above or similar kind of question, you should visit the post written by  Sergei Malynovskyi in BP3 Portal. It is really well written post.

Best thing to take from the post is how to see extended data in instumentation monitor page. 

If you dont know it already, it will open whole new world of monitoring you can do for IBM BPM. You can also visit below Tech Note for more details.