Avoid Overloading the Archive Subsustem

Discussion created by on Oct 19, 2012

We are using Pi server 2010 and back-loading to it from other, historical systems. With several of us doing this at once, it is not difficult to have the Archive subsystem fall behind and have everything end up the event queues. One way to avoid that happening is to have your data loading program send data only if the server is not falling behind.


In your loop that copies data to the server, call SleepForATad() before each data push.


Create a Point on on the server and call it EVENT_QUEUE_SLEEP_THRESHOLD. Use the archive editor to set its value. I have been using 200,000.

 Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Private Sub SleepForATad(ByVal seconds As Integer)

        Dim EventsInPrimaryQueuePoint = dest_piserver.GetPoints("tag = ""MCN." & m_DestServerName & ".PISnapshotSubsystem.EventsinPrimaryQueue""")(1)
        Dim CurrentThresholdPoint As PISDK.PIPoint = dest_piserver.GetPoints("tag = ""EVENT_QUEUE_SLEEP_THRESHOLD""")(1)

        Do While True
            If EventsInPrimaryQueuePoint.Data.Snapshot.Value < CurrentThresholdPoint.Data.Snapshot.Value Then
                Exit Do
            End If
            System.Console.Out.Write(".")   ' maybe I should write zzz...

    End Sub

 With several programs pushing data to our server, the event queue still varies from 0 to 600,000 or so. I think that is because the value of the EventsInPrimaryQueue doesn't get updated as often as SleepForATad queries it.