*3.4. Data Storage*

Data storage to the database on each WAVEMQ router is handled by an XBOS service called the "data ingester." This service, along with the tiered WAVEMQ message bus, allows SPO to access multiple data stores for the same data at different designated and/or site routers, as needed, without configuring additional data replication or mirroring scripts. SPO takes advantage of this feature by providing the capability of deploying the whole system—the drivers, data storage and optimization engine—locally with a building's local area network, provided that all the required data can be obtained from local devices and services.

For buildings and sites that allow both cloud and local communication, the preferred approach is to deploy the essential and critical drivers and applications such as sensor and actuator drivers and optimization engine locally and deploy drivers that communicate with web services (e.g., utility demand response (DR) servers, weather APIs, etc.) and read-only applications (e.g., benchmarking tools and visualization dashboards) on the cloud. Such a strategy limits the drivers that have access to local actuators to be located within the local network, and also reduces the chance that a controller remains in a suspended state due to loss of connectivity to cloud-based intelligence. With this network configuration, multiple data ingester services can be configured across the local site router and the cloud designated router. While the local ingester ensures that the most recent data are always available locally for the optimization engine and other critical applications, the ingester on the cloud can store the messages to a more persistent cloud data store for permanent storage and analytical applications. This preferred architecture is illustrated in Figure 3.

**Figure 3.** The services on the site router continue to run even during network outages.

The caveat in Figure 3 is that the critical applications on the site router should not require any data from the drivers on the designated router. If applications require data from external web services, it is recommended to host the drivers that are querying them directly on the site router to minimize points of failure.
