IMD SolutionComputing LibraryShop main store

Troubleshooting

PI Server event queue flush period and seconds-late archive data

Edge computing and IIoT Published 8 min read

Short answer

A PI Server 2015 upgrade changed how often the snapshot event queue is flushed to disk, and frequent flushes can lock the snapshot and archive subsystems until archived values fall seconds behind. Set the flush period back toward one second and restart both subsystems.

On this page
  1. Why does archived PI data fall seconds behind after a PI Server 2015 upgrade?
  2. What does the Snapshot_EventQueueFlushPeriod tuning parameter control?
  3. How do I tell whether the lag is in the interface, the snapshot, or the archive?
  4. Why can frequent queue flushes stall the snapshot and archive subsystems?
  5. What flush period should I set, and how do I apply it?
  6. Does flushing less often risk losing event queue data?
  7. Should I check storage before changing the tuning parameter?
  8. Questions asked

Raise the snapshot event queue flush period back to its pre-2015 rate and restart the snapshot and archive subsystems. On a server ingesting on the order of a quarter-million snapshots each second, the more frequent queue flushing introduced with PI Server 2015 can lock the snapshot and archive subsystems often enough that overflow queues grow and archived values fall seconds behind real time. The parameter is Snapshot_EventQueueFlushPeriod, the units are milliseconds, and the fix is a tuning change plus a subsystem restart, not new hardware. Work through the isolation steps below first: they confirm the lag sits between the snapshot and the archive, not in an interface or a timestamp, before you touch the tuning parameter.

Why does archived PI data fall seconds behind after a PI Server 2015 upgrade? #

The most likely cause after a PI Server 2015 upgrade is the snapshot event queue flush period: PI Data Archive 2012 flushed once per second, PI Data Archive 2015 changed that default to a flush every 10 ms, and a later correction settled it at every 50 ms. The symptoms that follow are characteristic: overflow queues fill with events, archived history trails the current value by seconds, and the trend only recovers when ingestion drops. A server that behaved before the upgrade and lags after it, at unchanged ingestion, points at what the upgrade changed rather than at the points, the interfaces or the network.

The correction tracked as Known Issue 161685 lowered the default from the 2015 value and restored the tuning parameter, but a build that contains it is still far more aggressive than the pre-2015 default. The reported failure occurred on PI Server 2015 R2 SP1, build 3.4.395.8, which already carries that correction. So a fully patched server can still lag: the correction restores configurability and lowers demand, it does not add disk capacity.

What does the Snapshot_EventQueueFlushPeriod tuning parameter control? #

Snapshot_EventQueueFlushPeriod sets how often the snapshot subsystem flushes its memory-mapped event queue to disk, in milliseconds; it first appeared in build 3.4.363.60, was disabled in PI Data Archive 2015, and came back with the fix tracked as Known Issue 161685. You view and edit it with the Tuning Parameters tool against the connected Data Archive server, and the vendor's documentation lists it among the Data Archive tuning parameters. Because it was disabled for a time, a server upgraded across the 2015 boundary may not show it until a corrected build is in place.

Do not confuse it with Archive_SecondsBetweenFlush, which governs how often the archive subsystem flushes its own cache and defaults to 5 minutes. That parameter is minutes-scale and belongs to the archive cache; the seconds-scale lag described here belongs to the snapshot event queue. If your build lists Snapshot_EventQueueFlushPeriod in the tuning parameter table, it is editable, and the running subsystems take up the new value after the snapshot and archive subsystems restart.

How do I tell whether the lag is in the interface, the snapshot, or the archive? #

Split the data path at the snapshot: when PI SMT's Current Value is current while the historical trend is late, the fault is downstream, in the queue-to-archive path; when both are late, the problem is upstream, in the interface or the snapshot itself. Work one point through the whole path rather than judging from a trend picture:

  • Pick one point that lags consistently and record its timestamp and value at the operator display.
  • Open the Current Value view in PI SMT and compare that point against the operator display and against a direct archive read covering the same interval.
  • Search the SDK logs for warnings or errors from pisnapss and piarchss and line them up with the lagging interval.
  • Where a buffer service fronts the interfaces, trace one point with pibufss -trace <ptid> and compare event timestamps against buffer transit; when the writing interfaces run on the server host itself, the buffer is not in the path and tracing it tells you nothing.
  • Watch overflow queue growth and correlate it with disk latency counters for the disk that holds the event queue file.

Rule out a timestamp cause first: a clock shift on the data source reads like late arrival on a trend but behaves differently, as covered in why PI tags stop updating after a manual clock change. The decision is mechanical: a fresh Current Value with late history puts the fault in the queue-to-archive path, and that is the case flush tuning addresses.

Why can frequent queue flushes stall the snapshot and archive subsystems? #

Every flush locks the event queue while its contents are written to disk, so the cost that matters is the disk write finished under that lock; when that write is slow, frequent flushes leave the queue locked so often that event processing toward the archive starves. Other operations that need the queue wait out each lock, so the queue fills faster than it drains and spills temporarily into the event queue file. The same fill-faster-than-drain arithmetic governs any buffering stage, and the troubleshooting of queue lag in Node-RED scratchpad writes walks the same diagnosis from the edge side.

A single flush moves a chunk of about 64 kB by default, so the problem is never the transfer size; it is the wait behind other I/O on the same disk. Measure flush completion and disk latency rather than assuming the storage is adequate because each write looks small. The decision here is firm: if the queue's disk shows high latency, fix the storage first, because tuning cannot make a slow disk fast.

What flush period should I set, and how do I apply it? #

Set Snapshot_EventQueueFlushPeriod to 1,000 ms as the working baseline, restart the snapshot and archive subsystems, and judge the result by the %Processor Time and %Private Bytes counters of the snapshot and archive subsystem processes falling back toward their pre-upgrade levels. Apply it in this order:

  1. Record the current parameter value and capture baseline counters for pisnapss and piarchss in a perfmon data collector set, so the before-and-after comparison is measured, not remembered.
  2. Set the parameter to 1000 (the entry is in milliseconds).
  3. Restart the snapshot and archive subsystems.
  4. Watch archived values against the Current Value view across an interval that includes a normal production peak.
  5. On a development system, shorten the period in 100 ms steps while the counters stay flat, and stop at the first step where they rise.

Worked example, using the loads reported for the failing server: ingestion of roughly 250,000 snapshots per second, about 80,000 archive events per second after compression, and an archive of about 1 GB filling in roughly 30 minutes. At the shipped period the flush frequency is 1000 ms / 50 ms = 20 flushes per second; at the baseline period it is 1000 ms / 1000 ms = 1 flush per second. That is twenty times fewer locked disk operations competing with the archive writes, and in the reported case the subsystem processor and private-memory counters dropped and archived values tracked real time again. Note that the archive fill rate describes the ingestion load, not the flush latency; treat the two as separate observations. The decision: put the baseline into production now to stop the lag, and refine the value downward only on a development system.

Does flushing less often risk losing event queue data? #

Shorter periods shrink how much queue content an ungraceful shutdown can lose, because the queue on disk is only as current as the last flush; the trade is shutdown durability against storage load. Lengthen the period and the window widens, so a server that loses power holds less of its recent queue content on disk. Neither setting is an end-to-end data-loss guarantee: interfaces, buffers, in-memory processing and archive persistence each carry their own exposure, and the queue flush covers only one of those stages.

For a server that is actively falling seconds behind at high ingestion, availability of the data beats the shutdown window, so run the baseline and accept the wider window until the lag is characterized. If a controlled shutdown is available, take it before changing the parameter, and let the measurement on the development system tell you how much durability you are giving up at each step.

Should I check storage before changing the tuning parameter? #

Before changing anything, confirm the event queue file, the archives and the operating system sit on separate physical I/O resources, because separate logical drives on one RAID array are still one resource and every flush competes with the rest of that array's traffic. In the reported failure the operating system and the queue file sat on separate logical drives of a single array, the archives had their own array, and the hosts were physical rather than virtual; even so, the flush path shared the array with the operating system. Set up perfmon disk counters for the queue's disk during testing and let them settle the question of what else touches that spindle set.

The decision follows directly from what you find. If the event queue file already owns its own physical I/O, go straight to the tuning change. If it shares an array with the operating system or with other heavy writers, move the queue file or the competing load first, then tune; otherwise you are tuning around a disk that no period value can fix.

Questions asked

Where do I edit Snapshot_EventQueueFlushPeriod?

In the Tuning Parameters tool of PI SMT, applied to the connected Data Archive server; the vendor's documentation lists it among the Data Archive tuning parameters. The entry is in milliseconds, so 1000 restores the one-second baseline described above. Running subsystems apply the new period only after the snapshot and archive subsystems restart, so a restart is part of the change, not an optional extra.

Is the buffer subsystem involved in this lag?

Only when remote interfaces send their data through a buffer service before it reaches the server. When the writing interfaces run on the PI Server host itself, as synchrophasor interfaces commonly do, nothing buffers the writes and a buffer trace shows no path at all. Confirm where each writing interface runs before spending diagnostic time on the buffer.

Does the same tuning apply to a virtualized server?

The parameter behaves the same, but the storage check changes: two logical drives on one host array are still a single physical I/O resource, and every other virtual machine on that host competes with each flush. The installation described here ran on physical servers with the archives on their own array. Establish what physically sits behind the virtual disks before tuning.

What period should the server run long term?

A value between the corrected default and the baseline, found by experiment rather than by rule. Hold the baseline until the lag clears, then shorten in 100 ms steps on a development system while the snapshot and archive subsystem processor and private-memory counters stay flat, and stop at the first step where they climb.

Keep reading

  • Explainer

    Why a PI value timestamp is not a receipt time

    No, an AFDataPipe event carries one timestamp — the value's event time, assigned by whatever wrote it — and the PI Data Archive exposes no per-value server receipt time. A sync over a one-way diode therefore restarts from the earlier of the two readers' last sent timestamps minus an overlap margin, journals every event locally before sending, and reconciles archives on a schedule. Treat 0% data loss as a requirement you validate, not something AFDataPipe guarantees.

    Edge computing and IIoT

  • Explainer

    Does the PI Data Archive store tag data in SQL Server

    No. The PI Data Archive writes time-series tag values to its own proprietary storage and never uses SQL Server for tag data; SQL Server is in the PI Server stack only for PI AF, whose asset model lives in a SQL database treated as a black box. A SQL Server backup therefore protects the asset model and none of the tag history.

    Edge computing and IIoT

  • Selection guide

    PI Server hardware sizing for 20,000 tags and five clients

    A 20,000-tag PI Server build is sized by its ingest rate in events per second, not by tag count: divide each scan class's tags by its period and sum. AVEVA's tested-topology guidance selects Topology 2A up to 5,000 events per second and Topology 2B from 5,000 to 20,000; bring the rate, the tag split, client counts, retention and availability to the vendor's topology review.

    Edge computing and IIoT

Log one-second trends and one-minute reports in one historian