Performance Optimisation with a Real-Time Database

Embedded control systems are gaining an increasing amount of responsibility in today’s vehicles and industrial machines. As mechanical components are replaced by software, the complexity of control systems and the amount of data they are responsible for greatly increase. Generally there are two approaches to dealing with this huge amount of information, but both have flaws which can reduce system performance, or in the worst case scenario cause fatal system failures with potential to cause loss of human lives.The two approaches are creation of large purpose-built data structures with shared variables, and implementation of a database. The first is often not scalable, becomes tremendously complex, and has high development costs, while the latter has the common downside that many databases are simply too slow. This study will explore the possibilities of using a real-time database to overcome these issues.As part of one of their control systems, CC Systems have developed the Diagnostic Runtime Engine (DRE) which keeps track of the state of the system. The database currently used in the DRE is too slow and this thesis project aims to replace it with a Mimer SQL Real-time Edition database. This real-time database utilises a unique concept called database pointers to access data in hard real-time. Although the real-time database comes with some issues and limitations of its own, this study shows that most of them can be worked around rather easily. Implementation of the real-time database would allow the DRE to handle incoming signals more than 50 times faster than the demands, as well as heavily decrease the complexity of the DRE’s source code. Mimer SQL Real-time Edition works entirely with in-memory copies of database tables, and the tables must be explicitly saved, or flushed, to the disk…

Contents

1 Introduction and background
1.1 Purpose
1.2 Method and testing environment
1.3 Delimitations of the study
1.4 Brief outline of the report
1.5 Source evaluation
2 Theoretical concepts
2.1 Real-time – hard and soft transactions
2.2 API – Application Programming Interface
2.3 Memory pages
2.4 C++ concepts
2.4.1 Struct
2.4.2 Vectors and queues
3 The technical context of this thesis projec
3.1 Brief overview of Crosstalk
3.2 The CCP-XS
3.3 The Diagnostic Runtime Engine
3.4 The database architecture
3.4.1 The database architecture for alarms
3.4.2 Creation of an alarm
3.5 The Graphical User Interface
4 The old database
4.1 Functionality of the old database
4.1.1 The PREPARE statement
4.1.2 Placeholders
4.1.3 UPDATE and COMMIT
4.2 Issues with the old database
4.2.1 Slow processing of incoming alarms
4.2.2 Slow execution of the commit cycle
4.2.3 Consequences of the problems
4.2.4 Summing up the old database
5 Mimer SQL Real-time Edition – how does it work?
5.1 Database pointers and hard real-time access of data
5.2 Code examples of how to use database pointers
5.3 Real-time flagged tables
5.4 The Mimer RT API
5.5 Multi-row pointer types
5.5.1 Logging multi-row policy
5.5.2 Static multi-row policy
5.6 Creating a real-time database
5.7 Changing data pagesize
5.8 Flushing – the way it works
5.9 Data visibility
5.10 Example of a real-time session
6 Mimer RT – does it work? Evaluation of functionality
6.1 The 10.0.4 chronology
6.1.1 Mimer RT 10.0.4A
6.1.2 Mimer RT 10.0.4D – 2008-10-21
6.1.3 Mimer RT 10.0.4E – 2008-12-03
6.1.4 Mimer RT 10.0.4E – Quick Release 2 – 2008-12-05
6.1.5 Mimer RT 10.0.4E – Quick Release 3 – 2008-12-17
6.1.6 Mimer RT 10.0.4E – Quick Release 4 – 2009-01-09
6.1.7 Mimer RT 10.0.4E – Quick Release 5 – 2009-01-19
6.1.8 Additional comments to the releases
6.2 Strengths, limitations and differences in functionality
6.2.1 Much less complex code with Mimer RT
6.2.2 RT disables soft write queries
6.2.3 Different data types
6.2.4 SQL INSERT is not supported
6.2.5 Static multi-row pointer versus vector of single-row pointers
6.2.6 RT can not read or write primary keys
6.2.7 Memory buffer full every 5th run
7 Performance tests and results
7.1 Binding large pointers takes time
7.2 Write operations in RT have superior response time
7.3 Choice of flush method
7.3.1 Pros and cons of the two flush methods
7.3.2 Comparing to commit
7.3.3 The effect of one-cell support tables
7.3.4 Flushing large amounts of data
7.3.5 Optimising the flush
8 Conclusions
9 References
9.1 Bibliography
9.2 Other printed references
9.3 Electronic references
9.4 Other references – oral and email communication
10 Appendix
10.1 Appendix I: Dictionary
10.2 Appendix II: Worst case execution times according to Mime
10.3 Appendix III: My C++ code for AlarmMgr.cpp
10.4 Appendix IV: The SQL code I wrote for creating tables
10.5 Appendix V: My guide to Mimer SQL Real-time Edition

Author: Wikensjo, Andreas

Source: Uppsala University Library

Download URL 2: Visit Now

Leave a Comment