Best AWS EC2 Instance Type for My React, Python, and Postgres Setup?

0
22
Asked By CuriousCoder42 On

Hey folks! I'm working on a system with a Frontend built on React and JavaScript, a Python REST API for the backend, and two Pgvector instances along with a regular Postgres database. The static Pgvector instance holds about 1GB of PDFs for general knowledge, while the dynamic one grows as users upload PDFs during chat sessions. I also have a normal Postgres database for user logins and chat conversations. I'm expecting my application to support around 500 to 1000 users, and I'm looking for advice on which EC2 instance family would be the best fit for this setup. Any tips or guidelines on selecting the right instance type would be greatly appreciated! 🤗

2 Answers

Answered By DatabaseDynamo On

For your stack, the biggest load will likely come from Postgres and Pgvector, so focus on instances that excel in memory and I/O, not just CPU. Here are some tips:

- **Separate Services**: Avoid cramming everything into one EC2 instance. Host your React app on S3 with CloudFront, run your backend on a separate instance, and have your databases on yet another.
- **Database Instance**: For embeddings, consider memory-optimized options like `r6g.large` or `r6g.xlarge`. They handle large vectors and benefit from RAM caching.
- **Backend Processing**: Look at compute-optimized (C family, e.g., `c6g.medium`) depending on how busy your API will be.
- **Storage Needs**: Go for gp3 EBS with high IOPS rather than gp2 to keep those inserts and queries running smoothly.

Starting out, you could use one `r6g.large` for Postgres/Pgvector and one `m6g.large` for your backend. This should give you a solid foundation, allowing for scaling later if necessary!

Answered By IntuitiveTechie99 On

You might want to consider starting with memory-optimized instances like the `r6a` or `r6g` family if you're open to using Graviton processors. They offer more RAM for the cost, which could be beneficial for your load. Also, don’t forget about AWS Compute Optimizer—once you have metrics from your usage, it can help you choose the best instance types based on actual CPU and RAM usage. Until then, starting small, like `r6a.large`, seems like a good idea. Monitor how your queries perform and adjust as necessary!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.