Sunday, November 21, 2010

Cacheable Command ! a really cool performance addition

If you are using Dynacache for you commerce site. This functionality is one of the coolest features that could be incorporated to improve caching results drastically.
It has 2 parts:
1. Writing the actual cache able command extending CacheableCommandImpl
2. Making the entry in cachespec.xml

In the command implementation, mandatory methods to be implemented
public void setOutputProperties(TargetableCommand fromCommand)
public void performExecute() throws Exception
public boolean isReadyToCallExecute() {

Good candidates for this kind of caching would be any complex computational logic such as Geo lookup, ATP messages or any complex logic that requires lot of computation and if the underlying data changes dynamically, will need to also build the cache invalidation with it.

STAGEPROP ! Mystery behind the starting number !

I have worked on stageprop over the years on several issues but this is an interesting one that I had to wake up really early morning to help resolve.
Lots of clients have millions of records to STAGEPROP so some clients use a batch commits to avoid memory problems from loading the whole set. The usage of STGPKEY is very important to remember, if there is a STAGEPROP issue where the STAGELOG processed flag is manually changed states from unprocessed to processed and back. It is very important to understand that the starting number in STAGEPROP comes from the query below.

select stgpkey from staglog where stgrfnbr=0;

Thursday, November 18, 2010

Show after discount prices in Product page\Category pages

If you have or higher versions of commerce. You can use the bean below to retrieve price after discounts.


Before this bean, it was very performance intensive and complex to retrieve price after discount prices.

It is important to understand that it works by creating a temp order and out of the box, it only works by sending 1 catentry at a time, for multiple items, this bean needs to be extended.

The price is calculated as if an order is placed that includes only the current catalog entry with quantity of one. I haven't used this in a live site hence I am curious about the performance of this bean.

Sunday, November 7, 2010

Debugging, memory problem at the appserver

In the past when we saw there were memory issues that brought down the entire site. We have used a few methods but this was the most effective and helped us figure out the issue. Heap dumps are pretty good but they take a long time and tools have size/JDK/OS limitations to load them.

Application servers > server1 > Process Definition > Java Virtual Machine

Set this parameter in the Generic JVM arguments

The histogram gave a pretty good idea of the objects in memory that helped us trace the issue.

Wednesday, November 3, 2010

Pillars of SEO !

1. To have short URLs with productnames, categorynames and having keywords in these links.
2. Canonical URL links in the HTML header.
This is for the search engines to look at this tag and to digest the page in question should be treated as though it were a copy of the URL and that all of the link & content metrics the engines apply should technically flow back to that URL.

<link rel="canonical" href="http://hostname/product/en/abc350" />
<link rel="canonical" href="http://hostname/category/en/s_furniturechair" />

3. Generating Google site map periodically.
4. XML site map and keeping at the root of the shop.
5. Link building and using Fat Navigation\Fat Footer With using key words in links.

Monday, November 1, 2010

Common Errors that could bring down a site?

1. If you have a couple of traces on Websphere or Commerce in production environment that is good enough to bring down the eCommerce site.
2. TrashCan user disabled. This could really spike up the CPU utilization and could also cause DB locks.
3. Dynacache servlet caching disabled, the CPU on the application and DB server would spike up that could potentially bring down the server.
4. Cart with number of items greater than 50 added to an individual cart with active promotions against those items and if the quantity is increased to a big number.
5. Not correctly setting this parameter could bring down the server.
Application servers -> web container transport chains ->WCInboundDefault->TCP Inbound Channel (TCP_2) -> Maximum open connections. (Specifies the maximum number of connections that are available for a server to use.)