Skip to content

Latest commit

 

History

History
92 lines (50 loc) · 5.18 KB

00.reference-architectures.md

File metadata and controls

92 lines (50 loc) · 5.18 KB

Reference Architectures

There are 3 architectures your can implement when develop on my.saas.

  1. the stand-alone architecture,
  2. the distributed database architecture; and
  3. the master-slave-worker architecture.

Outline:

  1. Stand-Alone Architecture
  2. Stack
  3. Extensibility
  4. Pre-Built Extensions
  5. Distributed Database Architecture
  6. Master-Slave-Worker Architecture

1. Stand-Aline Architecture

MySaaS Stand-Alone Architecture

In the stand-alone architecture, all My.SaaS components are deployed on a single server, running locally. This configuration is ideal for small-scale applications or development environments, where simplicity and low overhead are key.

2. Stack

The stack represented in the picture belows illustrates the underlying technologies that power a My.SaaS implementation. It includes the following components:

  • Nginx 1.18: A high-performance web server responsible for handling HTTP requests and serving static and dynamic content.

  • Sinatra / Puma: Sinatra is a lightweight Ruby web framework, while Puma is a concurrent web server designed for running Ruby/Rack applications, ensuring efficient request handling.

  • BlackStack Framework: A custom framework tailored specifically for My.SaaS, providing the core application logic and structure.

  • Ruby 3.1.2: The programming language used for developing the My.SaaS application, known for its simplicity and productivity.

  • PostgreSQL 12.20: A powerful, open-source relational database management system, used to store and manage application data.

  • Ubuntu 20.04: The operating system on which the entire stack runs, providing a stable and secure environment.

This stack forms the foundation of the My.SaaS platform, enabling it to deliver a reliable and scalable service.

MySaaS Stack

In this stack, Nginx runs on top of Sinatra/Puma with the sole purpose of handling HTTPS requests on port 443. It forwards these requests to Sinatra, which operates over HTTPS and typically listens on port 3000. This setup ensures secure and efficient request processing in the My.SaaS implementation.

3. Extensiblity

The image below showcases the various extensions that can be added to a My.SaaS implementation, enhancing its functionality.

The purpose of extensions is to add functionalities to My.SaaS in a modularized way, without needing to alter the core of the platform.

MySaaS Extensions

4. Pre-Built Extensions

The image below displays the full list of pre-built My.SaaS extensions, showcasing a range of modular features that can be easily integrated into the platform.

These extensions provide ready-to-use functionalities, enhancing the capabilities of My.SaaS without requiring modifications to its core architecture.

MySaaS Extensions

5. Distributed Database Architecture

The distributed database architecture consists on connecting my.saas to a serverless database instance of CockroachDB.

MySaaS Distributed Database Architecture

It is an effective approach if your SaaS platform requires interaction between all users, necessitating the bundling of all user data into a single database.

However, there are some drawbacks to using a serverless service:

  • Cost Scaling: Serverless databases can lead to rapidly increasing costs, especially if your SaaS performs heavy backend processing, as usage scales with demand.

  • Cost Tracking: It can be challenging to track and predict costs when working with serverless databases, making budget management more complex.

  • Despite these cons, the benefits of scalability and ease of use make serverless databases a strong option for SaaS platforms that need to manage a unified data structure across all users.

6. Master-Slave-Worker Architecture.

The master-slave-worker architecture, shown in image below, is designed for cost-effective resource deployment by assigning each user to a specific server, simplifying cost management.

MySaaS Distributed Database Architecture

  • Master: This server handles user signups, logins, invoice creation, and payment processing. It also allows users to create subaccounts, which are stored on the slave nodes.

  • Slaves: These servers host the subaccounts created by users. Typically, each subaccount is assigned to its own dedicated slave node, ensuring isolated and efficient resource usage.

  • Workers: Worker nodes are dedicated servers that handle offline processing tasks for subaccounts. Each worker node is typically assigned to one specific subaccount, managing its background processing tasks.

MySaaS Distributed Database Architecture

This architecture ensures straightforward cost control while providing scalable and efficient resource management for My.SaaS deployments.