Tuesday, August 10, 2010

Multiple Sessions/LogonId in Commerce 6.0 ? not supported OOB

Authentication framework in Commerce:
The current WCS 6.0 implementation supports a single session at any given time for a user and when you try to login from a different browser/Device using the same loginId. It kills the other active session.

Essentially the context of a user in WCS is handled by a serviced called Business Context Services, essentially it folds into the Business context engine which controls the behavior of the business components over the lifetime of a session.
It uses a couple of tables CTXDATA and CTXMGMT, to manage the context. Essentially each time a user comes to the site, a new activity is created in CTXMGMT and
it associates the calling user (Users_id as CALLER_ID) with an ACTIVITY_ID . The ACTIVITY_ID remains the same in the course of the session and it also keeps all the contexts associated with the activity in CTXDATA table.

When the same user logs in from a different device or a separate browser, essentially the previous context in CTXMGMT is marked as T (Terminated). It creates a new activity with a state A (Active).

Out of the box this is the behavior and I don’t know if commerce provides any API to customize multiple activities active. I know from my past experience, whenever a user has multiple activities active due to any discrepancies, he cannot login into the site at all and gets a business context exception. I can think of a customization to manage activities outside of business context and mapping them to the same user.


Monday, August 9, 2010

Learning from a DBA

I have a good friend who was visiting for a conference and we had a chance to catchup on things and he is a total enthusiast for technology and database and was kind enough to go over some tips for tuning DB for development environments.

1) Problem statement, Oracle 10g instance on windows takes by default around 600MB RAM? Reduce to 300MB

Login as:
sqlplus \ as sysdba

SQL>show parameter sga;

------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 584M
sga_target big integer 584M

SQL>alter system set sga_target = 300M scope=both;

SQL>alter system set sga_max_size = 300M scope=spfile;

Dynamic changes in Oracle are defined by giving the parameter scope=both and changes that need a restart are defined by scope=spfile;

SQL>shutdown immediate

show parameter sga;

------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 300M
sga_target big integer 300M

2) Problem statement tuning Dev Oracle Server to work with Application server:

Oracle 10G captures snapshots by default every hour. We can take a look at 3 kinds of reports

Go to command prompt under following directory

sqlplus \ as sysdba

These are the 3 kinds of reports, the first one is very elaborate and it lists out the top queries and also if there is any resource contention.




From looking at the resource contention he identified that it was writing to 3 control files and that is not required for a development database, so we changed to 1 and the log file needed to be increased.

SQL> alter system set control_files='C:\ORACLE\ORADATA\ORCL10G\CONTROL01.CTL' scope=spfile;

SQL> shutdown immediate

SQL> startup