{"id":1062,"date":"2021-04-28T21:03:50","date_gmt":"2021-04-28T19:03:50","guid":{"rendered":"https:\/\/www.rocworks.at\/wordpress\/?p=1062"},"modified":"2021-05-02T19:10:57","modified_gmt":"2021-05-02T17:10:57","slug":"automation-gateway-with-apache-iotdb","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=1062","title":{"rendered":"Automation Gateway with Apache IoTDB&#8230;"},"content":{"rendered":"\n<p>The Frankenstein <a href=\"https:\/\/github.com\/vogler75\/automation-gateway\/\">Automation Gateway<\/a> can now write OPC UA tag values to the <a href=\"https:\/\/iotdb.apache.org\">Apache IoTDB<\/a>. Did some rough performance tests with 50 OPC UA servers and one IoTDB&#8230; the IoTDB is pretty impressive fast. Also the data model and terminology is interesting and it seems to fit good to a hirarchical structure in OPC UA.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"670\" src=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43-1024x670.png\" alt=\"\" class=\"wp-image-1071\" srcset=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43-1024x670.png 1024w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43-300x196.png 300w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43-768x503.png 768w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43-1536x1005.png 1536w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Screenshot-2021-04-29-at-22.46.43.png 1892w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>In this lab I have connected 50 OPC UA servers (based on a .NET OPC UA server example) to Frankenstein. Each OPC UA server publishes 1000 tags of different type, so in summary we have 50000 tags connected to Frankenstein. The publish rate can be adjusted by setting an OPC UA tag. Sure, we do that via GraphQL over Frankenstein. On my commodity hardware I ended with writing about <strong>250Khz<\/strong> to the IoTDB with an CPU load of ~200%. So, I assume the IoTDB is able to handle much more value changes per second. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"365\" src=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz-1024x365.png\" alt=\"\" class=\"wp-image-1072\" srcset=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz-1024x365.png 1024w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz-300x107.png 300w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz-768x274.png 768w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz-1536x547.png 1536w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2021\/04\/Frankenstein-250khz.png 1678w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Figured out that one DB Logger inside of Frankenstein roughly is able to handle 100000 events per second. We can spawn multiple DB Logger for scalabilty. Vert.X can then use multiple cores (Vert.X calls this pattern the Multi-Reactor Pattern to distinguish it from the single threaded reactor pattern).<\/p>\n\n\n\n<p>Just to note: there is only a memory buffer implemented, so if the DB is down, then the values will be lost if the buffer runs out of space. But I think to handle such situations it would make sense to put Apache Kafka between the Gateway and the Database.<\/p>\n\n\n\n<p> GraphQL Query to set the simulation interval:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>query ($v: String) {\n  Systems {\n    opc1 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc2 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc3 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc4 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc5 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc6 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc7 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc8 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    opc9 { Demo { SimulationInterval { SetValue(Value: $v) } } }\n    ...\n  }\n}\nQuery Variables: {\"v\": \"250\"}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Frankenstein Automation Gateway can now write OPC UA tag values to the Apache IoTDB. Did some rough performance tests with 50 OPC UA servers and one IoTDB&#8230; the IoTDB is pretty impressive fast. Also the data model and terminology is interesting and it seems to fit good to a hirarchical structure in OPC UA. &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=1062\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Automation Gateway with Apache IoTDB&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,39],"tags":[40,35],"class_list":["post-1062","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-frankenstein","tag-iotdb","tag-opcua"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1062"}],"version-history":[{"count":6,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1062\/revisions"}],"predecessor-version":[{"id":1075,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1062\/revisions\/1075"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}