multi tenant application on Amazon EC2 - amazon-ec2

Note: I edited this question because I try to ask more as a question not as an opinion.
Our application is a multi tenant application being developed using Java, JBoss, and MySQL on Linux.
if application is multi-tenancy should we launch 1 instance per customer or or should we launch 1 instance for all customers ?
When and why we should launch new instance while we have one already?
Thanks
Best Regards

This is not a great question for here since the questions are likely to be a bit too opinionated. But I will give you some thoughts about what you wrote.
Having one customer confined to one instance gives you no failover. If the instance fails, the application is down until you can restart or relaunch the instance.
You should probably think about building clusters than can host several customers, 2-4 instances each, with failover and load balancing. (Maybe also use Multi-AZ RDS to host mysql)
Customer specific configuration needs to get out of JBoss and into your application somehow, I dont know the details of the platform so I cannot provide specifics.

Whether to launch one instance per customer or not is purely based on the solution you want to provide, the requirement, the load and the multi tenant strategy you decide to use. There is no fixed answer.
If all the tenants load can be sustained by one instance and you are not worried about per tenant resource usage then one instance is just enough. Of Course, you will plan for high availability.
Here are a few answers i provided for other users questions regarding db design and scalability for a saas setup. I hope it helps.
Databse architecture (single db vs client specific db) for Building Enterprise Web (RIA) application on cloud
Explanation of Tenant Load Balancer in SaaS maturity model level 4
Architecture for SaaS based online portal

Related

I got some architecture questions

Warning : I'm new in application architecture and officially speaking - this is the first time I'm designing something this big. This is also my own application so I got full authority to change things.
I'm building a serverless application which consists of an on-demand application streaming platform.
Customers who seek to try a specific application (usually large and expensive ones like Photoshop or Solidworks for example) could have the possibility to directly try one from their computers, on their browser, while the application is running on a similar to their computer type of infrastructure.
I'd use the CI/CD pipelines and IaC technology to build EC2 infrastructure that will host these applications and use those same technologies to destroy that infrastructure, since it's volatile.
So to create/destroy that EC2 infrastructure I use the GitLab API.
I've thus decided to go with AWS Lambda & GitLab for now.
Now the architecture questions :
Is it better to have one serverless function that handles everything or several functions ?
I'm planning to destroy the EC2 infrastructure after a certain amount of time (10-15 minutes). How should I schedule HTTP communication? Should I use a queue like SQS? Should I use some database and check every minute?
Again, thanks a lot for your wisdom!
Edit : Clarification on some stuff.

Which t3 EC2 instance should i pick as a start when launching a spring/angular webapplication?

I have built a spring boot/angular web application that uses a mySQL database for storage. The web application's main purpose is to be like a social media website for gardeners. Next to this it has a couple of tools that allow the user to generate a personalized planting calendar based on the monthly average temperature curve of the region where the user lives. Alternatively the user can also generate a personalized planting calendar based on planting journals made by other users that live within a certain radius near the user doing the calendar generating. I am using Hibernate Search for this.
I do not expect to get millions of visits in the first months after launching the web application, so my question is: What would be the best ec2 instance type to start out with? Could a t3.micro support an application like that for the first months or two? Also, How will i know when the current instance type can no longer handle the incoming traffic without lag and therefore i need to upgrade to a bigger instance like t3.medium or large?
Thank you
If the instance is suitable or not depends on many things. Based on my experience a micro instance is not enough for many use cases.
My suggestion is to start with a t3.small instance, start gathering metrics in CloudWatch to establish your baseline for few days. Then decide if it is enough or not.
If you are filling all your resources you can eventually upgrade to a bigger instance. However if your app is dealing with Java I think that a medium size is the minimum start.
About the lag and other things, first suggestion is to put CloudFront on top of the EC2 at least for all your static content (suggestion: put your static contents on S3 don't let EC2 serve them). Then I think that the only option is to rely on some third party performance tool, external to AWS.
By the way, I have built the same app on iOS many years ago, with a support website hosted on AWS. Now the app is gone, and the website is unmaintained :-)

Service Fabric multi-tenant

We are planning to use Azure Service Fabric for a data-oriented multi-tenant application. Typically 100+ customers each with 5 - 100 users.
Looking at the documentation, I concluded that the best approach is to use an Application instance for each customer, rather than trying to use Profiles to achieve multi-tenancy.
Is this the best way to go ?
An application instance for each customer is a good way to handle multi-tenant situations on a single cluster, yes. There are Service Fabric applications that do this today (Azure DB is a notable one).
Here are some things you get with this approach:
Each application instance gets its own process, which means you have process-level isolation per tenant.
Each application instance is composed of one or more services, which means you can use a "microservices" architectural style for the application.
Each application instance can be created with unique parameters, so you can have various setups for each tenant. For example, you can do things like offer higher availability to certain tenants by using higher replica set size settings for the services in their application instance, or you can offer higher data capacity by using a higher partition count setting for the services in their application instance.
These are generally good things for data-oriented multi-tenant situations but whether or not its the best way to go of course depends on your specific requirements.

Hosting Plan for Multi-tenant ASP.NET Application

If i have a multi-tenant asp.net MVC application, something like basecamp ,what's the suitable hosting plan for me, is it a "Shared Hosting" or "Dedicated Server" is best fit for me.
Some parameters for the project:
- Each tenant will have a different database.
- Each tenant will have its own sub-domain.
- Expected number of tenants in the first year for the product, about 1000 tenant.
So how can I manage the hosting part of this project ?
Am open for any suggestions even if they are not part of my question.
To decide which infrastructure best fits your application you need to take into account parameters like how "active" your tenants will be or how "heavy" your application is.
For example, a simple, read only application for 1000 user may fit a pretty small dedicated server. But a different system may need a couple of DB servers and 3 web servers in a load balanced configuration (a basecamp-like with 1000 users may need a configuration like that)
You should not underestimate this problem: I don't think that a single server would be powerfull enough, and when you have more than one server your sysadmin problems start to grow :)
Remember that another viable alternative is hosting your application in a cloud environment (ie: http://aws.amazon.com or Microsoft Azure). But sometimes going to the cloud need a different approach on application's architecture.
Also, remember to take into account consideration like the availability of your application (ie: what happens when the server goes down?)

Google Bigtable is concept of multi-tenant database or not?

I don't know what is true or not. Can you advise me?
Wikipedia defines multitenancy as:
Multitenancy refers to a principle in software architecture where a single instance of the software runs on a software-as-a-service (SaaS) vendor's servers, serving multiple client organizations (tenants).
So, the question becomes does google run an single instance of bigtable, or an individual one for each client on their app servers? To be honest there's no real way of knowing. A single instance scenario could isolate clients so it appears as if they have their own individual version running, conversely you couldn't tell if you have your own individual server running either - google hasn't released enough information either way.
It's unlikely that every google apps customer gets their own instance to connect to, but unless google makes a statement either way, it's all just guesswork.

Resources