Archive for July, 2010


Counter Description / Thresholds
Memory -
Available Bytes
Description: Available Bytes is the amount of physical memory, in bytes, immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to the standby (cached), free and zero page lists.
Thresholds: If the average value of the counter is less then 300MB, otherwise the server experiences a performance hit due to memory pressure.
Memory -
Page Faults/sec
Description: This counter gives a general idea of how many times information being requested is not where the application (and VMM) expects it to be. The information must either be retrieved from another location in memory or from the pagefile. Recall that while a sustained value may indicate trouble here, you should be more concerned with hard page faults that represent actual reads or writes to the disk. Remember that the disk access is much slower than RAM.
Thresholds: 0 is the optimum measurement. Any measurement higher than zero delays response time and probably indicates not enough RAM
Memory -
Pages/sec
Description: Pages/sec is the rate at which pages are read from or written to disk to resolve hard page faults. This counter is a primary indicator of the kinds of faults that cause system-wide delays.
Thresholds: It should typically be 0–20. (Unhealthy if greater than 80; probably indicates not enough RAM.)
LogicalDisk -
Avg. Disk Bytes/Transfer
Description: Measures the size of input/output (I/O) operations.
To analyze transfer data further, use Avg. Disk Bytes/Read and Avg. Disk Bytes/Write.
Thresholds:
- The disk is efficient if it transfers large amounts of data relatively quickly.
- Watch this counter when measuring maximum throughput.
LogicalDisk -
% Free Space
Description: Reports the percentage of unallocated disk space to the total usable space on the logical volume.
PhysicalDisk -
Avg. Disk sec / Transfer
Description: How fast is data being moved (in seconds)? This counter measures the average time of each data transfer, regardless of the number of bytes read or written. It shows the total time of the read or write, from the moment it leaves the Disk Performance Statistics Driver to the moment it is complete.
Thresholds:
> 0.3 seconds may indicate disk controller needs too many retrys. Include Faster drives.
PhysicalDisk -
Avg. Disk Bytes/Transfer
Thresholds:
< 20K may indicate an app. is accessing too little at a time.
PhysicalDisk -
Current Disk Queue Length
Description:
Are disk requests waiting?
Thresholds: If more than 2 request are waiting over time, the disk may be a bottleneck.   More hard drives.
PhysicalDisk -
% Disk Time
Description: How often is the disk busy?
This value is displayed as a percentage and is capped at 100%.
Thresholds: If it’s busy almost all of the time (>90%), and there is a large queue, the disk might be a bottleneck.   More hard drives.
Network Interface -
Output Queue Length
Description: Output Queue Length is the length of the output packet queue (in packets). Since the requests are queued by Network Driver Interface Specification (NDIS) in this implementation, this value is always 0.
Thresholds: If this is longer than 2, there are delays and the bottleneck should be found and eliminated, if possible
Network Interface -
Packets Received/sec
Packets Received/sec is the rate at which packets are received on the network interface.
Network Interface -
Packets Sent/sec
Packets Sent/sec is the rate at which packets are sent on the network interface.
Network Interface -
Packets/sec
Packets/sec is the rate at which packets are sent and received on the network interface.
Processor -
% Processor Time
Description: % Processor Time is the percentage of elapsed time that the processor spends to execute a non-Idle thread. It is calculated by measuring the percentage of time that the processor spends executing the idle thread and then subtracting that value from 100%.
Thresholds:
- Less than 60% consumed = Healthy
- 51% – 80% consumed = Monitor or Caution
- 81% – 100% consumed = Critical or Out of Spec Scale CPUs
System -
Context Switches/sec
Description: Context Switches/sec is the combined rate at which all processors on the computer are switched from one thread to another. Compare this value with the value of Web Service\Total Method Requests/sec.
Thresholds:
- Context switches per request (Context Switches/sec divided by Total Method Requests/sec) should be low.
- high context switches/sec – more than 5000 context switches per second
- Very high context switches/sec – more than 15,000 context switches per second

Reference: Windows 2000 Resource Kit Performance Counters Start Page

Fatwire initially provides some basic building assets, which we can use while setting up a site. Page, Query, Template, CSElement … is few of them.

Note: Fatwire treat every thing as asset (eg. Template)

Page asset is used to create site plan. We can define child parent relation ship within our site plan using page assets. It totally depends on our design how many level of hierarchy we will use. Its not possible to customize Fatwire provided assets (Page in our case), means we can’t introduce new attributes with these assets. But Fatwire provide a provision to create association. Using association, we can associate any asset type with our page asset.

I have divided this article in two parts:
1. How to create association with page asset
2. How to access associated assets

1. How to create association with page asset?

  • Login to system with admin rights
  • Go to Advance environment
  • Goto Admin > Asset Types > Page > Asset Associations
    Here we will find all association with page asset (see Figure 1)

    Figure 1 - Page associattions

    Figure 1 - Page associations

  • To create a new association, click on “Add New” and fill the form (see Figure 2)
    Figure 2 - Create new Association with Page asset

    Figure 2 - Create new Association with Page asset

    Name: Name of new association, please make it informative, we will be using this name to get the associated assets.
    Description: Description we want to provide. Can be same as name
    Child Asset: If we want to associate only specific asset type, then select that asset type from drop down. If any asset can be associated then leave it “Any”
    Page SubTypes: If we are using page subtypes and want this association with only some specific sub types, then select the sub type otherwise leave it “Any”
    Mirror Dependency Type: It’s a trade off and totally depends on business requirement. Select this value to Exact version if any change to the associated asset will require approval for publish of Page otherwise keep it Exists. I will suggest keeping it Exists.
    Multivalued Association: single valued / multivalued

  • Click “Add New Association” Button
  • We can find this new association on page creation form (eg. See Figure 3)

    Figure 3 - Page Creation Form with Associations

    Figure 3 - Page Creation Form with Associations

    NOTE: We can create number of associations with page assets

2. How to access associated assets?

We can use <asset:children … /> tag to get the associated assets. The syntax is as follows:

<asset:children type=”Page” assetid=’<%=ics.GetVar(“pageId”) %>’ list=”myList” code=”associationName” order=”nrank” />

Description:

type: asset type, “Page” in our case
assetid: Page asset id
list: named list which will refer to the fetched assets. We will use this list to get the asset ids
code: Give the name of association (which we have created)
order: “nrank” to return an ordered list. Applicable in case of multivalued association only.

We can use “myList” to get the associated assets. This list has two attributes (otype, oid)

otype: type of associated asset
oid: id of associated asset

Iterate through the list:

// Check for empty list. Its a common practice to avoid any error. Please see Common errors and their Prevention
<ics:if condition=’<%=null != ics.GetList(“myList”)&& ics.GetList(“myList”).hasData() %>’>
<ics:then>

<ics:listloop listname=”myList”>

<ics:listget listname=”myList” fieldname=”otype” output=”c” />
<ics:listget listname=”myList” fieldname=”oid” output=”cid” />

</ics:listloop>

</ics:then>
</ics:if>

Next Read :
Fatwire | How to create new Category with Page asset

Problems

If You Carry Your Problems on Your Head,
Their Weight Will Crush You

but

If You Put Them Under Your Feet,
They Will Serve Like Stairs.

Something special for someone

I Would Conquer The Whole World With Just One Hand,

If You are Holding The Ohter … !!!

Can you fool MOM?

You Can Fool Some of The People All of The Time And All of The People Some of The Time

But

“You Can’t fool MOM”

  1. ics:listloop tag failure
  2. Invalid type specified: Page
  3. Need a ‘ID’ field & Need a ‘Type’ field
  4. ics:setvar missing or empty argument value
  5. Error: no object named <ObjectName>
  6. Error -101 in tag ics:selectto with table Template_Composition

1. Error: ics:listloop tag failure

Root Cause: This error occur if asset type [c] and/or asset Id [cid] passed to tag <assetset:setasset/> or <asset:load/> is NULL.

<ics:listloop listname=”myList”>

</ics:listloop>

Solution: Always apply null check before iterating a list.

<ics:if condition=’<%=null != ics.GetList(“myList”) && ics.GetList( “myList” ).hasData() %>’>
<ics:then>

<ics:listloop listname=myList”>

</ics:listloop>

</ics:then>
</ics:if>

2. Error: Invalid type specified: Page

Root Cause: This error occurred, If type passed to <assetset:setasset /> tag is a basic asset eg. Page. As Page asset is basic type asset. And this tag is meant to load Flex Asset.
This code will give “Invalid type specified: Page” error:

<ics:setvar name=”c” value=”Page“/>
<ics:setvar name=”cid” value=”123456789″/>
<assetset:setasset name=”asset” type=’<%=ics.GetVar(“c”)%>’ id=’<%=ics.GetVar(“cid”)%>’ />

Solution: Check asset type and use <asset:load> tag for basic assets.

<ics:setvar name=”c” value=”Page“/>
<ics:setvar name=”cid” value=”123456789″/>

<ics:if condition=’<%=“Page”.equals(ics.GetVar(“c”)) %>’>
<ics:then>

<asset:load name=”AsscAsset” type=’<%=ics.GetVar(“c”)%>’ objectid=’<%=ics.GetVar(“cid”)%>’/>

</ics:then>
<ics:else>

<assetset:setasset name=”AsscAsset” type=’<%=ics.GetVar(“c”)%>’ id=’<%=ics.GetVar(“cid”)%>’ />

</ics:else>
</ics:if>

3. Error: Need a ‘ID’ field & Need a ‘Type’ field

Root Cause: This error occur if we try to iterate through an uninitialized list.
Solution: We should put NULL check on c and/or cid in such a situation where there is possibility for NULL value.

<ics:if condition=’<%=ics.GetVar(“c”) != null && ics.GetVar(“cid”) != null %>’>
<ics:then>

<assetset:setasset name=”myAsset” type=’<%=ics.GetVar(“c”)%>’ id=’<%=ics.GetVar(“cid”)%>’/>

</ics:then>
</ics:if>

4. Error: ics:setvar missing or empty argument value

Root Cause: This error occur if we try to set null as value in <ics:setvar /> tag.
Solution: Set some Default value for variable at the top of the page or Write code in a manner so that no chance to NullPointer, NumberFormat … exception.

5. Error: no object named <ObjectName>

Root Cause: This error occurred when asset loaded is NULL and we are trying to get data from the object.

<asset:load name=”TestObject” type=’<%=ics.GetVar(“c”) %>’ objectid=’<%=ics.GetVar(“cid”) %>’ />
<asset:get name=”TestObject” field=”id” output=”asset:cid”/>

Solution: Put NULL check on object before getting data out of it.

<asset:load name=”TestObject” type=’<%=ics.GetVar(“c”)%>’ objectid=’<%=ics.GetVar(“cid”) %>’ />
<ics:if condition=’<%=ics.GetObj(“TestObject”) != null %>’>
<ics:then>

<asset:get name=”TestObject” field=”id” output=”asset:cid”/>

</ics:then>
</ics:if>

6. Error: Error -101 in tag ics:selectto with table Template_Composition

Root Cause: If there is no record found for SQL for tag <ics:selectto/>, then it returns (-101) Error code.
Solution: I will suggest to use SQL query (using <ics:sql /> tag) instead of <ics:selectto/>. Also Its always good to use SQL query (with join in 3-4 tables) instead of <asset:load> tags … Its a trade off and you are the best person to decide which one to use.

The difference between school and life?

In school, you’re taught a lesson and then given a test. In life, you’re given a test that teaches you a lesson. .!!

In any kind of implementation, i (actually everyone) perform some empty string operation:

if(null != myString && !"".equals(myString))
    ...
}

.equals() method compare each character of strings to check the equality. In the example above we are:

  • Creating a String object (“”) with 0 length
  • using .equals() method to check if both strings are equal or not

Note: String class store values as char array

But when i had a look into the implementation of .equals() method, the idea comes in my mind why not use length() method in this scenario to save the .equals() overhead. length() method just return the length of string which String class store in count variable at the time we create String object. So its definition looks like:

public int length() {
    return count;
}

As simple as it can be. So i have simply replaced my code with length() metohd

if(null != myString && !0 == myString.length()) {
    ...
}

Is it safe to replace .equals() with .length() in my code?

It depends on your requirement actually, equals() method check for equality of two objects (string in our case), while .length() just return the number of characters in String object.

Follow

Get every new post delivered to your Inbox.