{"id":7062,"date":"2022-07-24T23:47:41","date_gmt":"2022-07-25T06:47:41","guid":{"rendered":"https:\/\/tdengine.com\/?p=7062"},"modified":"2025-11-03T08:09:51","modified_gmt":"2025-11-03T16:09:51","slug":"environmental-monitoring-and-data-governance-at-scale","status":"publish","type":"post","link":"https:\/\/tdengine.com\/environmental-monitoring-and-data-governance-at-scale\/","title":{"rendered":"Environmental Monitoring and Data Governance at Scale"},"content":{"rendered":"\n<p>GESRI created a project that would help enterprises use big data technology to manage their environmental management and governance goals and comply with environmental regulations. Instead of leaving enterprises to create their own platform to solve the issues of data governance, quality management and associated tasks like data cleaning, ETL, aggregation and so on, GESRI&#8217;s platform would provide the basis for accurate governance and intelligent decision making.<\/p>\n\n\n\n<p>The real-time data warehouse structure of this project is shown in the figure below. The status of environmental quality and real-time pollution discharge, in air, surface water, coastal waters, fixed and mobile pollution sources, can be captured in real-time. The real-time monitoring data can be further analyzed for early warning of possible harmful environmental events.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-d4941ca8\"><img decoding=\"async\" width=\"800\" height=\"419\" class=\"gb-image gb-image-d4941ca8\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture.png?strip=all&amp;sharp=1 800w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture-300x157.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture-768x402.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture.png?strip=all&amp;sharp=1&amp;w=160 160w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture.png?strip=all&amp;sharp=1&amp;w=480 480w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-01-architecture.png?strip=all&amp;sharp=1&amp;w=640 640w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Establishing a real-time data warehouse of environmental data and exposing centralized collection, aggregation and analysis services, is more efficient than having various organizations build the same software platforms. This promotes software reuse and also promotes best practices and standards.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-07ea9c94 gb-headline-text\">From a relational database to TDengine<\/h2>\n\n\n\n<p>Since this is a real-time data warehouse, the database solution required for it has much higher performance requirements than those of a general database application. The storage layers must provide extremely high write and read performance with very low latency. Due to the vast amounts of data, it must also provide very efficient and compact storage.<\/p>\n\n\n\n<p>In our case, there are nearly 5000 monitoring stations and each station monitors 3-5 factors of key pollutant discharge units every 30 seconds. For many years, we used a relational databases for data storage and were only able to keep data for 3-5 days and had to delete old data on a daily basis. We considered using PostgreSQL&#8217;s <a href=\"https:\/\/tdengine.com\/tsdb-comparison-timescaledb-vs-tdengine\/\">TimescaleDB<\/a> extension, but it could not meet certain regulations having to do with monitoring and control of individual devices. We also tried to use another <a href=\"https:\/\/tdengine.com\/what-is-a-time-series-database\/\">time-series database<\/a> (TSDB) product, but its performance and general interface were still far from our requirements.<\/p>\n\n\n\n<p>When we first came into contact with TDengine, we were a little hesitant because the product was so new. <strong>Fortunately, TDengine is easy to install and has complete documentation. Even though it is an open source product, product support is very comprehensive. There is also a dedicated technical group on social media. When problems arose, we were always able to get help from TDengine support staff and the TDengine community. Our entire evaluation process was very smooth. <\/strong>Finally, after a long period of research and testing, we chose the open source time series database, TDengine.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-32316cf8 gb-headline-text\">Deployment and performance of TDengine<\/h2>\n\n\n\n<p>For the deployment of TDengine, we chose three, 4-core servers with 8G RAM each, one 8-core server with 16G RAM and one 8-core server with 32G RAM for a total of 5 servers. These servers were configured as a 5-node single-copy cluster. There are three business lines that have been put into operation. These include the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automatic monitoring system of key pollutant discharge units every 30 seconds.<\/li>\n\n\n\n<li>Real-time data reporting of OBD for heavy-duty diesel vehicles<\/li>\n\n\n\n<li>Real-time monitoring data reporting of VOCs polluting enterprises.<\/li>\n<\/ul>\n\n\n\n<p>We also perform automatic monitoring of data reporting services, as well as data analysis and data application services.<\/p>\n\n\n\n<p>From April 2021 to the present (January 2022), the project has created 4 <a href=\"https:\/\/tdengine.com\/supertable\/\">supertables<\/a> and 67,453 subtables.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b004069a\"><img decoding=\"async\" width=\"425\" height=\"53\" class=\"gb-image gb-image-b004069a\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-02-dnodes.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-02-dnodes.png?strip=all&amp;sharp=1 425w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-02-dnodes-300x37.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-02-dnodes.png?strip=all&amp;sharp=1&amp;w=85 85w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-02-dnodes.png?strip=all&amp;sharp=1&amp;w=170 170w\" sizes=\"(max-width: 425px) 100vw, 425px\" \/><\/figure>\n\n\n\n<figure class=\"gb-block-image gb-block-image-488860f8\"><img decoding=\"async\" width=\"364\" height=\"227\" class=\"gb-image gb-image-488860f8\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-03-row.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-03-row.png?strip=all&amp;sharp=1 364w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-03-row-300x187.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-03-row.png?strip=all&amp;sharp=1&amp;w=72 72w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-03-row.png?strip=all&amp;sharp=1&amp;w=145 145w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-03-row.png?strip=all&amp;sharp=1&amp;w=218 218w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/figure>\n\n\n\n<figure class=\"gb-block-image gb-block-image-e45a4040\"><img decoding=\"async\" width=\"364\" height=\"225\" class=\"gb-image gb-image-e45a4040\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-04-schema.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-04-schema.png?strip=all&amp;sharp=1 364w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-04-schema-300x185.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-04-schema.png?strip=all&amp;sharp=1&amp;w=72 72w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-04-schema.png?strip=all&amp;sharp=1&amp;w=145 145w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-04-schema.png?strip=all&amp;sharp=1&amp;w=218 218w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/figure>\n\n\n\n<p>To illustrate the storage process, we take the 30-second monitoring data of exhaust gas emissions from key polluting enterprises as an example.<\/p>\n\n\n\n<p>The <code class=\"\" data-line=\"\">st_om_rtd_gas<\/code> table is a supertable we created for waste gas treatment. It<strong> stores 7.65 billion pieces of data (a total of 16 billion data in the four supertables), scattered in 19,419 subtables, with an average of 390,000 rows per table. Due to the characteristics of TDengine supertable, coupled with columnar storage and ultra-high compression capability, these data only occupy 240G of storage.&nbsp; <\/strong>Not only does this significantly reduce our storage space and costs, but also lays a good foundation for data query performance.<\/p>\n\n\n\n<p>In terms of queries, our main logic is to obtain the recent maximum series value, filter and obtain a list of monitoring factors that have exceeded limits, and then query the hourly, daily and monthly maxima through downsampling. We can then query specific discharge outlets to determine the list of discharge outlets with high pollutant discharge concentration or flow rate for a period of time, and then analyze each discharge concentration within a specific time range to obtain detailed information on abnormal discharges. TDengine has successfully completed the above query analysis process with excellent performance.<\/p>\n\n\n\n<p>Here are examples of specific queries:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT top(val_zs, 20) FROM st_om_rtd_gas&lt;br&gt;WHERE moni_time &gt;= NOW - 2h&lt;br&gt;GROUP BY pol_code;<\/code><\/pre>\n\n\n\n<figure class=\"gb-block-image gb-block-image-a744c985\"><img decoding=\"async\" width=\"567\" height=\"128\" class=\"gb-image gb-image-a744c985\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-05-query-1.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-05-query-1.png?strip=all&amp;sharp=1 567w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-05-query-1-300x68.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-05-query-1.png?strip=all&amp;sharp=1&amp;w=113 113w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-05-query-1.png?strip=all&amp;sharp=1&amp;w=226 226w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-05-query-1.png?strip=all&amp;sharp=1&amp;w=453 453w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<p><strong>For the 7.6 billion row hypertable, the grouped TOP query took only 0.2 seconds.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT MAX(val_zs) FROM st_om_rtd_gas\nWHERE moni_time &gt;= now -2h AND pol_code IN (&#039;002\u2019,&#039;\u2018010&#039;)\nINTERVAL(1h) GROUP BY ps_code,p_code,pol_code;<\/code><\/pre>\n\n\n\n<figure class=\"gb-block-image gb-block-image-5b246dd8\"><img decoding=\"async\" width=\"567\" height=\"102\" class=\"gb-image gb-image-5b246dd8\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-06-query-2.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-06-query-2.png?strip=all&amp;sharp=1 567w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-06-query-2-300x54.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-06-query-2.png?strip=all&amp;sharp=1&amp;w=113 113w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-06-query-2.png?strip=all&amp;sharp=1&amp;w=226 226w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-06-query-2.png?strip=all&amp;sharp=1&amp;w=453 453w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<p><strong>Based on TDengine returning 2,968 rows, it took only 0.06 seconds.<\/strong><\/p>\n\n\n\n<p>Now we extract the list of suspicious discharge outlets from the returned results to check the specific discharge situation:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT val, val_zs, ps_name, p_name, pol_name, strength_unit FROM st_om_rtd_gas&lt;br&gt;WHERE ps_code = 440000000168 AND p_code = 1101 AND moni_time &gt;= &#039;2021-12-27 00:00:00.000&#039;;<\/code><\/pre>\n\n\n\n<figure class=\"gb-block-image gb-block-image-9b388da2\"><img decoding=\"async\" width=\"567\" height=\"87\" class=\"gb-image gb-image-9b388da2\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-07-query-3.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-07-query-3.png?strip=all&amp;sharp=1 567w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-07-query-3-300x46.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-07-query-3.png?strip=all&amp;sharp=1&amp;w=113 113w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-07-query-3.png?strip=all&amp;sharp=1&amp;w=226 226w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.052-07-query-3.png?strip=all&amp;sharp=1&amp;w=453 453w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<p><strong>Returning 5,280 rows of data took only 0.1 seconds, and the performance completely exceeded our expectations.<\/strong><\/p>\n\n\n\n<p>It is worth mentioning that we are currently using virtual machines in our own data center and the performance of TDengine does not falter at all. In the near future, we plan to migrate to a cloud platform with better resources, and we believe that the performance of TDengine will increase.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-bb0013d6 gb-headline-text\">Next step: implementing edge layer construction based on TDengine<\/h2>\n\n\n\n<p>After using TDengine for several months, it has far exceeded expectations in terms of CPU load, data storage efficiency, data collection efficiency, and data query efficiency, meeting all the requirements of our real-time data warehouse. TDengine has strengthened our process of ecological and environmental data governance and has allowed accurate and timely detection of anomalous pollution discharge. TDengine has great potential in pollution prevention and control scenarios.<\/p>\n\n\n\n<p><strong>As our next step in fully exploiting the features of TDengine we plan to use some of it&#8217;s features to enhance the edge layer of our platform. Specifically, we plan to use the subscription function of TDengine to capture data from the edge and also process it immediately on the edge side to enhance real-time pollution prevention and control.<\/strong><\/p>\n\n\n\n<p>I am looking forward to newer releases of TDengine and hoping for a bigger and bigger TDengine community in the coming years.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GESRI built a highly scalable and performant environmental monitoring and data governance system for real-time detection and early warning of anomalies in pollution discharge based on stringent government requirements.<\/p>\n","protected":false},"author":81,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[23],"tags":[],"ppma_author":[167],"class_list":["post-7062","post","type-post","status-publish","format-standard","hentry","category-case-studies"],"authors":[{"term_id":167,"user_id":81,"is_guest":0,"slug":"chait","display_name":"Chait Diwadkar","avatar_url":{"url":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-05-cdiwadkar.jpg","url2x":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-05-cdiwadkar.jpg"},"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/7062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=7062"}],"version-history":[{"count":9,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/7062\/revisions"}],"predecessor-version":[{"id":29457,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/7062\/revisions\/29457"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=7062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=7062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=7062"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=7062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}