Giallorenzo Saverio, Montesi Fabrizio, Safina Larisa, Zingaro Stefano Pio
Università di Bologna, Bologna, Italy.
INRIA, Sophia Antipolis, France.
PeerJ Comput Sci. 2022 Jul 22;8:e1037. doi: 10.7717/peerj-cs.1037. eCollection 2022.
The adoption of edge and fog systems, along with the introduction of privacy-preserving regulations, compel the usage of tools for expressing complex data queries in an ephemeral way. That is, queried data should not persist. Database engines partially address this need, as they provide domain-specific languages for querying data. Unfortunately, using a database in an ephemeral setting has inessential issues related to throughput bottlenecks, scalability, dependency management, and security (, query injection). Moreover, databases can impose specific data structures and data formats, which can hinder the development of microservice architectures that integrate heterogeneous systems and handle semi-structured data. In this article, we present Jolie/Tquery, the first query framework designed for ephemeral data handling in microservices. Jolie/Tquery joins the benefits of a technology-agnostic, microservice-oriented programming language, Jolie, and of one of the most widely-used query languages for semi-structured data in microservices, the MongoDB aggregation framework. To make Jolie/Tquery reliable for the users, we follow a cleanroom software engineering process. First, we define Tquery, a theory for querying semi-structured data compatible with Jolie and inspired by a consistent variant of the key operators of the MongoDB aggregation framework. Then, we describe how we implemented Jolie/Tquery following Tquery and how the Jolie type system naturally captures the syntax of Tquery and helps to preserve its invariants. To both illustrate Tquery and Jolie/Tquery, we present the use case of a medical algorithm and build our way to a microservice that implements it using Jolie/Tquery. Finally, we report microbenchmarks that validate the expectation that, in the ephemeral case, using Jolie/Tquery outperforms using an external database (MongoDB, specifically).
边缘和雾计算系统的采用,以及隐私保护法规的出台,促使人们使用工具以临时方式表达复杂的数据查询。也就是说,查询的数据不应持久化。数据库引擎部分满足了这一需求,因为它们提供了用于查询数据的特定领域语言。不幸的是,在临时设置中使用数据库存在与吞吐量瓶颈、可扩展性、依赖管理和安全性(如查询注入)相关的非必要问题。此外,数据库可能会强加特定的数据结构和数据格式,这可能会阻碍集成异构系统并处理半结构化数据的微服务架构的开发。在本文中,我们展示了Jolie/Tquery,这是第一个为微服务中的临时数据处理而设计的查询框架。Jolie/Tquery结合了一种与技术无关、面向微服务的编程语言Jolie的优点,以及微服务中最广泛使用的半结构化数据查询语言之一MongoDB聚合框架的优点。为了使Jolie/Tquery对用户可靠,我们遵循净室软件工程流程。首先,我们定义了Tquery,这是一种用于查询与Jolie兼容的半结构化数据的理论,它受到MongoDB聚合框架关键运算符的一致变体的启发。然后,我们描述了如何根据Tquery实现Jolie/Tquery,以及Jolie类型系统如何自然地捕获Tquery的语法并有助于保持其不变性。为了说明Tquery和Jolie/Tquery,我们展示了一个医学算法的用例,并构建了一个使用Jolie/Tquery实现它的微服务。最后,我们报告了微基准测试结果,这些结果验证了在临时情况下使用Jolie/Tquery优于使用外部数据库(具体为MongoDB)的预期。