Measuring message processing performance

Firstly, LiveCycle Data Services 2.6 Developer Guide is amazing. Everything is explained clearly. LCDS team rocks :)

LiveCycle Data Services developer guide: http://www.adobe.com/go/lcds26_devguide

I was going through the document and found a topic which explains how adding a few tags in the services-config.xml file will get lots and lots of metrics regarding processing time of a message. Information regarding message size, server processing time, and network travel time is available to the clients. You can also get information on the server logs. This works for all types of channels. That means you can also measure performance for a Remoting call also. This is available in both BlazeDS and LCDS :)

You can find detailed explanation on this mechanism at this URL:

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/mpi_1.html

Few metrics I liked the most are message size, server adapter time, server processing time, server send time and total time. There are lot more, you can find a table explaining the metrics in the URL included above.

We will have a look at main steps required to enable gathering metrics with a Remoting sample.

On the server

First you need to tell your channel to send the metrics to the clients. For this you need to add 2 tags in services-config.xml under the channel tag as shown below. Here I am adding it for an AMF channel. I am using this channel for my Remoting Service destinations. In the code snippet below tags in bold are the ones to be added. You have to add the tags for the channel you want the metrics for.

<channels>

<channel-definition id=”my-amf” class=”mx.messaging.channels.AMFChannel”>

<endpoint url=”http://{server.name}:{server.port}/{context.root}/messagebroker/amf” class=”flex.messaging.endpoints.AMFEndpoint”/>

<properties>

<serialization><instantiate-types>false</instantiate-types></serialization>

<polling-enabled>false</polling-enabled>

<record-message-times>true</record-message-times>

<record-message-sizes>true</record-message-sizes>

</properties>

</channel-definition>

</channels>

On the client

MessagePerformanceUtils class will help you to parse the metrics from the message returned from the server. All you need to do is to pass the message to the MessagePerformanceUtils class constructor in the result handler. Once this is done, you will use MessagePerformanceUtils instance to retrieve the metrics.

Please download sample from this URL:

http://sujitreddy.g.googlepages.com/PerformanceMeasuringSample.mxml

In the function below which is the result handler in the sample code attached, you can see we are passing the message object returned by the server to the MessagePerformanceUtils class. prettyPrint() method of this class returns a formatted string of metrics. You can find more details on MessagePerformanceUtils class at this URL http://livedocs.adobe.com/flex/3/langref/mx/messaging/messages/MessagePerformanceUtils.html

private function handleServerResponse(event:ResultEvent):void{

remoteObject.removeEventListener(ResultEvent.RESULT, handleServerResponse);

remoteObject.removeEventListener(FaultEvent.FAULT,               handleServerFault);

//processing the result

var performanceDetails:MessagePerformanceUtils =

new MessagePerformanceUtils(event.message);

txtOutput.text = performanceDetails.prettyPrint();

}

Creating Remoting destination and Java class

Please find details on how to invoke Java methods from Flex using Remoting at this URL

http://sujitreddyg.wordpress.com/2008/01/14/invoking-java-methods-from-adobe-flex/

All you need to do is to create a Remoting destination with TestingOnly as id and set the source to a Java class with method below.

public String echo(String echoString){return echoString;}

That’s all you need to do :) now you have all metrics required to measure message processing performance.

About these ads

4 Responses to Measuring message processing performance

  1. Esteban says:

    Hi,

    i’m trying to measure message processing performance using blazeds, i create more than 3 different flex
    application, but always got the same error:

    Error: Message is missing MPI headers. Verify that all participants have it enabled.
    at mx.messaging.messages::MessagePerformanceUtils()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\messages\MessagePerformanceUtils.as:106]
    at traderdesktop/messageHandler()[C:\Projects\Flex\marketdata\src\traderdesktop.mxml:144]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.messaging::AbstractConsumer/http://www.adobe.com/2006/flex/mx/internal::messageHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\AbstractConsumer.as:727
    at mx.messaging::ConsumerMessageDispatcher/messageHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\ConsumerMessageDispatcher.as:246]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.messaging::ChannelSet/messageHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1363]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at PollCommandMessageResponder/resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\PollingChannel.as:746]
    at mx.messaging::MessageResponder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199]

    i think i have all well configured, but the MessageEvent dont has the mpi information.

    I really appreciate some help !

  2. Andrey says:

    If you still get “Message is missing MPI headers” error, check out my post (http://ndpar.blogspot.com/2009/06/measuring-livecycle-performance.html). It might help.

  3. jay says:

    We are using MessagePerformanceUtils for measuring total time and time required for server. if we use flex 3.2.0 and java 1.5 as middletier, we get both these values as +ve. But when we moved to Java 1.6 we begin to get total time as -ve. Is there any compatability issue of lfex 3.2.0 with Java 1.6???

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 111 other followers

%d bloggers like this: