Skip to content

Commit

Permalink
Merge pull request #205 from supertokens/image-updates
Browse files Browse the repository at this point in the history
Update images in infra blog part 1
  • Loading branch information
rishabhpoddar authored Oct 16, 2023
2 parents 5a71114 + 2cc37b9 commit 9348d96
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions content/how-we-cut-our-aws-costs-part-2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ Here's what we covered in our [last post](./how-we-cut-our-aws-costs/):

## What is multi-tenancy?

As mentioned in Part 1, "We saw multi-tenancy as an opportunity to optimize the utilization of our EC2 instances by consolidating our core instances. This would cut down our costs while also providing the expected performance"... But what does that mean? Lets break it down. Multi-tenancy is a feature, typically used by B2B SaaS companies to allow multiple organizations to sign up to their SaaS app, with the ability for each organization to have their own login methods or SSO configurations. Additionally, user pools can also be segmented. Heres how it helped us.
As mentioned in Part 1, "We saw multi-tenancy as an opportunity to optimize the utilization of our EC2 instances by consolidating our core instances. This would cut down our costs while also providing the expected performance"... But what does that mean? Let's break it down. Multi-tenancy is a feature, typically used by B2B SaaS companies to allow multiple organizations to sign up to their SaaS app, with the ability for each organization to have their own login methods or SSO configurations. Additionally, user pools can also be segmented. Here's how it helped us.

## How we implemented SuperTokens Multi-tenancy

With multi-tenancy we re-architected the way we host and manage our users. Initially whenever a signed up and created an app with SuperTokens, it would trigger the following flow:
With multi-tenancy, we re-architected the way we host and manage our users. Initially, whenever a user signed up and created an app with SuperTokens, it would trigger the following flow:

![SuperTokens Old Deployment Process](./supertokens-deployment-process.png)

In this process each development and production SuperTokens core ran in their own separate EC2 instances. With Multi-tenancy we now treat all SuperTokens customers as tenants. This means that we could now host multiple users on a single SuperTokens instance. Our deployment process now looks like this:
In this process, each development and production SuperTokens core ran in it's own separate EC2 instances. With Multi-tenancy we now treat all SuperTokens customers as tenants. This means that we could now host multiple users on a single SuperTokens instance. Our deployment process now looks like this:

![SuperTokens New Deployment Process](./supertokens-deployment-process-new.png.png)

As you can see in the new deployment strategy, when a new user signs up, we now create a new tenant in a SuperTokens instance. These instances run in `T3 large` instances. In our testing, for development mode, up to 100 tenants can be run seamlessly on a single instance and for production mode, up to 50 tenants can be created on single instance.
As you can see in the new deployment strategy, when a new user signs up, we now create a new tenant in a SuperTokens instance. These instances run in `T3 large` instances. In our testing, for development mode, up to 100 tenants can be run seamlessly on a single instance and for production mode, up to 50 tenants can be created on a single instance.

![SuperTokens infrastructure](./supertokens-infrastructure.png)

## What are the benefits of the new architecture?

### 1. Cost Savings

Well the biggest difference post this change is the cost savings.
Well, the biggest difference post this change is the cost savings.

Heres a bill for the month of July before the multi-tenancy changes kicked-in:
Here's a bill for the month of July before the multi-tenancy changes kicked-in:

![SuperTokens AWS bill for July](./supertokens-aws-bill-july.png)

And heres the bill for September, post the changes going live
And here's the bill for September, post the changes going live

![SuperTokens AWS bill for September](./supertokens-aws-bill-september.png)

Expand All @@ -56,9 +56,9 @@ When compared, its **54%** down

### 2. Improved start up time

Another improvement was app startup time. In the new architecture, creating a new user is as simple as creating a new tenant. When compared to the old process, the new architecture is about 94% faster and new apps can be crated in seconds.
Another improvement was app startup time. In the new architecture, creating a new user is as simple as creating a new tenant. When compared to the old process, the new architecture is about 94% faster and new apps can be created in seconds.


## Conclusion

Multi-tenancy with SuperTokens is a powerful feature that enables businesses to create unique authentication flows for their customers, segment users into unique user pools and automatically create new new tenants. For SuperTokens, multi-tenancy allowed us to consolidate our user applications to save on resources, but, your use case maybe very different. You can learn more about how multi-tenancy works and the experiences it enables by visiting the [multi-tenancy feature page](https://supertokens.com/features/multi-tenancy)
Multi-tenancy with SuperTokens is a powerful feature that enables businesses to create unique authentication flows for their customers, segment users into unique user pools and automatically create new tenants. For SuperTokens, multi-tenancy allowed us to consolidate our user applications to save on resources, but, your use case maybe very different. You can learn more about how multi-tenancy works and the experiences it enables by visiting the [multi-tenancy feature page](https://supertokens.com/features/multi-tenancy)
Binary file modified static/card_covers/how-we-cut-our-aws-costs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/covers/how-we-cut-our-aws-costs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9348d96

Please sign in to comment.