Thursday, November 30, 2017

Coldfusion CFTHROW

Are you using CFThrow to throw custom exception in ColdFusion ? Wait. Read this article before using CFThrow in your application otherwise you will end up in slowing down your application.
Blow is the syntax of CFThrow

To throw an exception we are either required provide object of type java.lang.Throwable or use type information. There is no performance issue if you use object but if you are using type then you might slow down your application performance.

To understand the performance issue we are required to understand how coldfusion work if we you CFTHROW with type.  Coldfusion is responsible to create the exception object to be thrown and coldfusion use type information to create the exception object. The value of TYPE attribute could be the fully qualified java class name or some arbitrary string. Coldfusion always try to first lookup class with the name equal to the value of TYPE attribute using classloader which is slow and synchronized operation. If classloader is able to find class definition then object will be created using loaded definition and thrown else object of CustomException will be thrown.

With the of use some arbitrary value in TYPE attribute instead of fully qualified class name then classloader won't be able to find class definition and store value in cache. So every time we use  CFTHROW classloader will be required to search the class as class doesn't exists.  But if we use valid java class then classloader won't be required to search class the load as it will be in class loader cache after first load operation. 

So, use CFTHROW tag with either object attribute or type attribute with fully qualified class name.

Sunday, July 9, 2017

Hybris Collections Performance Improvement

When you are working in Hybris with one to many relation and relation contains more than 100 elements then you are should modify the below setting.

lazy.pkcollection.prefetchsize

The default value of this setting is 100. This value controls the number to child entities to fetch when working with one to many relation.

Oracle the max value for this setting is 1000.

Hybris Jalo Session

In Hybris 5.4 or below the Jalo sessions remain in memory for next 30 minute or default session timeout even after the user has logout or his session expired.

If you are using hybris 5.4 or below, you are required to set the following flag to true close the session after the user has logout or his session expired

hybris.improvedsessionhandling=true

Hybris Cart Management

In Hybris when the user logout from the application, then Hybris delete the cart associated with the user.

Hybris provides the setting to override this behavior. Set the following property to false to change this behavior.

session.remove.cart.on.close=false

Coldfusion CFTHROW

Are you using CFThrow to throw custom exception in ColdFusion ? Wait. Read this article before using CFThrow in your application otherwis...