Event Processing

padams edited this page Jan 28, 2015 · 1 revision

OWA supports two modes of event processing: synchronous and asynchronous.

Table of Contents

Synchronous

The Synchronus event processing mode means that OWA logging events are processed as part of your application. This means that OWA will block untill it is able to persist all data to the database. This mode is the easiest to manage but has the side effect of making your application (and the user) wait untill OWA is done.

Asynchronous

The asychronous event processing mode means that OWA will execute it's preprocessing steps but instead will log incoming tracking events to a log file for processing later by another php process. This mode has the advantage of making your application wait for OWA to persist data to the database, but it requires that you setup a secondary php process to process the log files periodically.

This asynchronous processing mode is very handy for situations where you want to maximize performance of your application. This procesing mode can also be used if you want to process events on a different server.

Processing Events Collected Across Multiple Servers

If you are running more than one OWA instance in async mode, there is a distinct possibility that the events that make up a single visitor's session while be recorded by different servers. Thus when you go to process the event log files resident on each server, events will inherently be processed out of order causing some events to "fail" (because other events that they require have not yet been processed).

To solve for this, OWA implements a secondary, database backed, event queue where failed events are stored and retried at a later time (usually a few minutes later).

Processing the event log files with a secondary php request

The easiest way to process the tracking event log files and the secondary event queue is to setup a cron job that would run the processEventQueue command every few minutes. An example crontab entry to run this command every 5 minutes would be:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * php /full/path/to/owa/cli.php cmd=processEventQueue