8. Architecture Overview

8. Architecture Overview

ยท

5 min read

Before we delve further into the project, it's essential to discuss the architectural overview. As previously mentioned, a key requirement is the implementation of multi-tenancy. The goal of the project is to enable the seamless execution of Windows Compatibility Tests for various organizations or departments within a company.

While one approach could involve creating multiple project instances, each linked to its respective database, this strategy has inherent challenges. Maintaining numerous instances for updates, fixes, and enhancements can be a cumbersome and time-consuming process, even though the underlying codebase remains the same.

To address this challenge, multi-tenancy offers a solution. It involves consolidating all tenants, which could be organizations or departments, within a single instance. This centralizes the management of the application while still ensuring data separation for each tenant. This approach significantly streamlines maintenance efforts, as any updates or improvements need to be made in just one instance, providing a more efficient and scalable way to handle the multi-tenancy requirement.

Now, the question is: How should we structure and organize our data at the database level to effectively implement this multi-tenancy model?

Multiple tenants in one single database

Having multiple tenants in a single database can offer several advantages and also some potential disadvantages that we need to consider.

Pro

  1. Cost efficiency. Multiple tenants sharing the same database infrastructure can help reduce hardware and operational costs.

  2. Reduced complexity. Fewer databases mean less complexity in system architecture, which can make it easier to maintain and troubleshoot.

  3. Quick onboarding. Adding new tenants can be faster and more straightforward in a multi-tenant system, as we don't need to set up a new database for each one.

Con

  1. Compliance challenges. Meeting regulatory and compliance requirements can be more complex, especially if tenants have different data protection and privacy needs.

  2. Performance contention. In highly resource-intensive multi-tenant environments, there can be resource contention issues, where one tenant's activities can impact the performance of others.

  3. Upgrade complexity. Updates or changes to the database schema or application can be more complex in a multi-tenant environment, as they need to be carefully managed to avoid disruptions for all tenants.

One tenant per database

Having one tenant per database, also commonly known as single-tenancy, offers some advantages and disadvantages in certain scenarios.

Pro

  1. Data isolation. Each tenant's data is completely isolated in their own database, reducing the risk of data leakage or unauthorized access. This makes it easier to meet stringent security and compliance requirements.

  2. No resource contention. Since each tenant has its own dedicated database, there is no resource contention between tenants, ensuring consistent and predictable performance.

  3. Ease of migration. Tenant data can be more easily migrated to different systems or platforms when needed, as each tenant's data is self-contained and not tightly coupled to others.

Con

  1. Resource underutilization. Single-tenancy can be less resource-efficient because each tenant's database may not fully utilize the available hardware resources, leading to higher infrastructure costs.

  2. Data sharing complexity. Sharing data or collaborating between tenants may be more difficult in single-tenancy, requiring additional integration efforts.

  3. Management overhead. If you have a large number of tenants, the management overhead can become significant, which may require additional automation and tools to streamline operations.

Having delved into various multi-tenancy models, along with their associated benefits and potential challenges, we are now ready to make a decision for our project. For educational purposes, I have opted to adopt the single-tenant database model as the foundation of our solution.

Additionally, this presents an excellent opportunity to introduce a powerful client library provided by Microsoft Azure SQL. In my upcoming post, I'll delve into how this library can assist us in effectively implementing the single-tenant database model, further enhancing the robustness and efficiency of our project.

Nonetheless, we haven't yet delved into the architectural overview of our solution. While we've established the choice of our database model, there are two pivotal components that I would like to introduce: the Gateway and the Agent.

So, what exactly are the Gateway and Agent? In a nutshell, these can be envisioned as the workers entrusted with the responsibility of testing applications on our behalf. Before we dive deeper into their roles and functions, let me first present an architectural overview diagram for a clearer visual understanding:

As you can see from the above diagram, the Gateway is positioned between the Portal and Agent(s), serving as an intermediary for both components. It also has the capability to access the (tenant) database. Each tenant will have a dedicated database, a Gateway, and potentially multiple Agents for different Windows versions.

Gateway

Initially, the Gateway might appear to be an optional component, as the Portal can directly communicate with the Agent to initiate test runs. This holds true in scenarios such as local testing or when there's a single Agent on a machine. However, in real-world situations, our testing requirements become more complex. We often need to conduct tests in at least two distinct environments: the current Windows version and a future Windows version. Within each of these environments, multiple sets of applications cater to different departments, such as HR, Accounting, and more.

In practice, the sheer number of Agents communicating directly with the Portal can create a cacophony of interactions that are challenging to coordinate. Additionally, an excessive number of Agents accessing the database could severely impact database performance and, consequently, the overall system's efficiency. This is precisely why the Gateway becomes a crucial addition to our architecture.

The primary responsibility of the Gateway is to orchestrate testing workflows among the Agents. It achieves this by alleviating Agents from unnecessary data access tasks, allowing them to concentrate solely on application testing.

Agent

Its primary role is to execute tests on applications within a specific Windows version environment. Upon receiving instructions from the Gateway, the Agent initiates the necessary preparations and commences the testing process for a given application. Once the test is completed, the Agent transmits the test results back to the Gateway and readies itself for the subsequent application test.

Conclusion

Now that we have a grasp of the architecture overview for effectively conducting Windows Compatibility tests across multiple tenants, we can conclude that, for the purpose of building a straightforward educational solution, this architecture provides a solid guidance. With this understanding in place, we are well-equipped to embark on the next phase of our journey.

Did you find this article valuable?

Support Han Chee by becoming a sponsor. Any amount is appreciated!

ย