Skip to main content
Version: Streamsheets 2.5

Introduction

The three main components of the Streamsheet platform are: Streamsheets, Apps and Streams. Streamsheets consume, process and produce data streams. In Excel, one or several sheets always form part of a Workbook. In a similar way, Streamsheets run in Apps and one App accommodates up to four sheets. Hence strictly speaking, the App consumes, processes, and produces data streams, and the Streamsheets contained in the App define how this happens exactly. Streams define the endpoints where messages are coming from and where they are sent to, hence data sources and data sinks. These endpoints can be e.g. MQTT and Kafka topics as well as OPC UA nodes, REST APIs, database collections or local directories.

StMFlow

Apps consume and produce streams. In the App`s Streamsheets the data flow logic is defined via functions.

Best Practices

With Streamsheets, many ways lead to your desired outcome. This is great because there is not only one route for you to create applications and realize your project. As your abilities grow and your applications start to get more complex, there are a couple of best practices you should look into to ensure your application is easy to maintain, bug free and resource-efficient. This guide provides some general recommendations and best practices for your app development.

Maintain

  1. Divide tasks into multiple applications

Not filling one application with all your ideas, but implementing these in a number of smaller apps, leads to several advantages.
The first is a good overview. Big applications have multiple sheets and often cross-references among them. If in addition, you do not document and comment properly, you might lose the overview of what is happening in which sheet. The bigger and more complex your app becomes, the harder it is to keep track of its logic. However, splitting your use case into distinct parts and realizing these in their own respective app, structures your workflow, while maintaining maximum visibility. Use the integrated Eclipse Mosquitto Broker to connect your apps and send data from app one to app two. This also serves as a great quality check, especially if you are tracking down issues in your logic. If the messages, arriving in app two, look as expected, app one properly works and the problem occurs somewhere further down the line.

  1. Document what you are doing

Work with comments and document the steps you are taking. This might not feel necessary while building your app, but you will surely do your future self (and/or colleagues) a great favor. The comments will help in understanding how your apps work.

  1. Visually divide the logic within an app

Similar to the division of tasks into multiple apps, try to separate the different calculations and “logic blocks” within one app visually, e.g. use different sheets or simply leave empty rows between tasks. This helps you in navigating through your app, its logic and extending it later on as your use case grows.

Bug free

  1. Remember the core principle of Streamsheet calculation

Left to right and top to bottom. This is the calculation principle of Streamsheets. One of the main differences between a normal spreadsheet and a Streamsheet is that a Streamsheets has a defined order of calculation. It starts by calculating A1, B1, C1, ..., then it jumps to the next row and calculates again A2, B2, C2, ... . This is an immensely powerful feature, but if forgotten, it can introduce unwanted logic dependencies. Example: If you are using a READ() function in B26, to get the latest data into your sheet, watch out to not accidentally add functions which reference to B26 above this cell. The reason is that all functions above B26 (e.g. A1) will calculate before B26, thus, these cells might not use the latest data from B26 because B26 updates after them. However, this feature gives you many options if you use it deliberately.

  1. Check your steps

Every step calculates the whole sheet. Keep this in mind and make sure the steps do not trigger functions unintentionally.

Calculation mode: If you are using STACKADD() or TIMESCALE.INSERT and your calculation mode is "continuously", these functions are executed every time the sheet is calculated. However, this does not necessarily mean that you have received new data to work with. Thus, you could be adding the same data repeatedly without wanting to. Make sure, the functions are only triggered, when they are supposed to. You can achieve this, for instance, by changing the calculation mode of the sheet to "on message", using IF-Cells (the 1st column of a Streamsheet) or the IF() function.

Resource-efficient

Streamsheets runs on servers, in the cloud or even on your laptop and there are a couple of things you can do to minimize the load your application creates.

  1. Divide tasks into multiple applications

Every application runs in its own process on the server. Dividing tasks into multiple apps allows the server to manage and allocate its resources more efficiently and gives you a better overall experience. For example: Create one application to store your data in a database. Based on that data you can now create multiple dashboards for multiple purposes. All in different apps.

  1. Keep Streamsheets clean

Make your app as lightweight as possible. There are a couple of performance dependencies you should look out for while creating your app.

  • Cycle time: The faster your app is running, the more resources are needed. Do you really need to set the cycle speed to 10ms?
  • Amount of cells: Fewer cells and fewer functions lead to an overall better performance. Instead of creating huge tables on the sheets, think about using databases and this way even persist your data. Save your calculated results and query/retrieve this data when and where you need it.
  • Use of the third dimension: In Streamsheets you sometimes use a third dimension to access data. Functions like TIMEAGGREGATE() or TIMESCALE.SELECT() hold data in their cell (they stack them into the “3rd dimension”). The bigger these stacked data sets get and the more you are using these functions, the more data is moved and calculated on each step. Usually you do not need to hold 10-thousands of data points. Aggregate your data in a smart way to make your app run even more smoothly.
  1. Add more resources

Streamsheets uses the number of CPUs, memory and disc space available. Make sure there is always enough. If you host yourself: Since your apps are running within a docker environment, first, check the amount of resources docker is allocating.

  • CPU and Memory: docker stats
  • Disc space: docker system df

Docker allows you to manage the allocated resources of your hardware. When using Docker Desktop, these resources are automatically limited. Go into your settings and adjust these in the Tab "Resources".

If your docker installation already allocates the maximum amount of resources, think about scaling up your setup.