4

Is there a way to capture the time consumption of Publish Transaction states like rendering,resolving,WaitingForDeployment....

3

The easiest way to get a rough idea of these times is to double click on the publish transaction in the publishing queue. That will bring you to a view like this:

Publishing phases details

As you can see, there is a start and finish time listed for each stage of publishing, down to the second. Often times this is enough to find publishing bottlenecks if they're on the scale of seconds or minutes.

If you require more detail than is provided here you would have to go to the logs Tridion generates, such as the transport or deployer log, depending on the phase you are specifically interested in.

To dig into the publishing time of the rendering phase specifically you could try something like Damian Jewett suggests at Tridion Developer: http://www.tridiondeveloper.com/timing-templates-with-a-stopwatch

  • Hi Brine Thanks for the response... can we capture Transaction TCM URI in Customresolver ? – USER1287 Sep 11 '15 at 13:46
3

You can implement a Event System to measure some of the parameters like RenderTime.

Second thing, the ScheduledForPublish, WaitingForPublish, ScheduledForDeployment, WaitingForDeployment, Resolving, Rendering are various states of a Publish Transaction.

So hook up into and handle the state change events ( Use the SaveEventArgs, SetPublishStateEventArgs class in Tridion.ContentManager.Extensibility.Events namespace) to measure the timings of PUBLISH TRANSACTION States

I Think EventPhases.Processed will be the best phase to get more accurate timings of state changes.

Sample I:

this.EventSystem.Subscribe<PublishTransaction, SaveEventArgs> 
(this.RecordStateChangeTimings, EventPhases.Processed);


private void RecordStateChangeTimings(PublishTransaction transaction, 
        SaveEventArgs args, EventPhases phases)
 {
  using (StreamWriter writer = File.CreateText(@"C:\PublishStateData.txt"))
   {
     writer.WriteLine("State" + transaction.State);
     writer.WriteLine("StateChangeTime" + transaction.StateChangeDateTime);
     writer.Close();
    }
 }

Below is the TOM.NET API description of the transaction properties used above:

enter image description here

Lastly, you may check the SetPublishStateEventArgs class as well and do something like below in the Event Handler:

Sample II:

private void RecordStateChangeTimings(PublishTransaction transaction, 
            SetPublishStateEventArgs args, EventPhases phases)
     {
      using (StreamWriter writer = File.CreateText(@"C:\PublishStateData.txt"))
       {
            foreach (ProcessedItem item in args.ProcessedItems)
              {
                 writer.WriteLine("RenderTime" + item.RenderTime.ToString());
              }
             writer.Close();
       }  }

And the API description: enter image description here

  • Thanks !! but i couldn't go with event system it would effect Tridion Performance – USER1287 Sep 11 '15 at 13:44
2

With a powershell script running against the core service, you can extract the data like this:

import-module Tridion-CoreService
$core = Get-TridionCoreServiceClient

filter PubTransToObjects (){
    $returnValue = new-object -TypeName PSObject
    $transportSummary = ([xml]$_.Information).TransportSummary

    $prepareTransport = (Select-Xml -Xml $transportSummary -XPath "Processing/Step[@type='Prepare transport']").Node
    $transporting = (Select-Xml -Xml $transportSummary -XPath "Processing/Step[@type='Transporting']").Node
    $deploymentPreparation = (Select-Xml -Xml $transportSummary -XPath "Processing/Step[@type='Deployment preparation']").Node
    $deploying = (Select-Xml -Xml $transportSummary -XPath "Processing/Step[@type='Deploying']").Node
    $committing = (Select-Xml -Xml $transportSummary -XPath "Processing/Step[@type='Deployment committing']").Node

    Add-Member -Name TotalTime -InputObject $returnValue -MemberType NoteProperty `
                -Value ([DateTime]$transportSummary.end - [DateTime]$transportSummary.start)

    Add-Member -Name PrepareTransport -InputObject $returnValue -MemberType NoteProperty `
                -Value ([DateTime]$prepareTransport.end - [DateTime]$prepareTransport.start)
    Add-Member -Name transporting -InputObject $returnValue -MemberType NoteProperty `
                -Value ([DateTime]$transporting.end - [DateTime]$transporting.start)
    Add-Member -Name deploymentPreparation -InputObject $returnValue -MemberType NoteProperty `
                -Value ([DateTime]$deploymentPreparation.end - [DateTime]$deploymentPreparation.start)
    Add-Member -Name deploying -InputObject $returnValue -MemberType NoteProperty `
                -Value ([DateTime]$deploying.end - [DateTime]$deploying.start)
    Add-Member -Name committing -InputObject $returnValue -MemberType NoteProperty `
                -Value ([DateTime]$committing.end - [DateTime]$committing.start)


    $returnValue

}


$ptFilter = new-object Tridion.ContentManager.CoreService.Client.PublishTransactionsFilterData
$pts = $core.GetSystemWideList($ptFilter) | %{$core.Read($_.Id,$null)}
$pts | PubTransToObjects | Export-Csv PubTransTimes.csv

By opening the resulting csv file in Excel, you can quickly make a pie chart like this, or whatever takes your fancy.

enter image description here

  • Just in case you hadn't realised, this is by way of a shameless plug for my forthcoming "Talking to Tridion" session at the Tridion developer summit. – Dominic Cronin Sep 10 '15 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.