Jump to content

Estimating hardware requirements for running code on a website

Puffhead

Hi there! My friend is currently running a homemade react & python application on the small $5 instance of digitalocean.

It's currently online and only used by the two of us for testing purposes. We're planning on putting the site up for the internet to use in the coming weeks, but because it's just the two of us, we can't get an idea of what we'll need for server horsepower/RAM/bandwidth if it's being hit by lots of people concurrently. Is there any way to benchmark this and get a rough idea of the requirements, or estimate what we'll need to be able to handle a load of 100 users at a time, for example?

I do have a server at home that definitely has the power, and the site wouldn't hold any sensitive information, but I don't feel safe exposing my hardware and network to the internet, and dealing with the additional work that comes with that. Also, we're trying to keep the hosting/server costs down, as this site will likely generate no revenue.

Any of you have any smart ideas to get an idea for what we would need hardware wise?

 

Here's the code:

https://github.com/AlmightyYakob/AstroPlanner-ui 

https://github.com/AlmightyYakob/AstroPlanner-api

Link to comment
Share on other sites

Link to post
Share on other sites

jmeter? dont run it on same machine as server tho

MSI GX660 + i7 920XM @ 2.8GHz + GTX 970M + Samsung SSD 830 256GB

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, Puffhead said:

Any of you have any smart ideas to get an idea for what we would need hardware wise?

React has a profiler: https://reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html

There are various tools available to profile python, including those builtin to the standard library.

On the whole though, what you could do is find some machine to run it on, any machine, and on a separate machine generate requests and watch how the performance scales as the number of active users increases.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

At work, I use a node module called autocannon for testing servers amount of requests locally

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

You can use a reverse proxy like Cloudflare, it should cache the client-side code

 

You can also use Cloudflare for your local server; since it's a reverse proxy, your local server won't be exposed to the outside

🙂

Link to comment
Share on other sites

Link to post
Share on other sites

https://loadimpact.com/ is a pretty easy load testing utility and the free tier can generate enough load for a small website.

 

Also - once it goes live, you can always check average response times to see if it is holding up or if you need to upgrade as you get more users.

Link to comment
Share on other sites

Link to post
Share on other sites

Bandwidth is pretty easy. Count the average size of data send to the server and received on the client. Then check how many queries per seconds on average you are doing and you can count per month how much you use.

 

The hit on CPU depends if your service is scalable and pop different instances of it while using it on multiple thread or not. If yes than multiple core is more important than speed. I currently have one of my main server with 2 Xeon 4 core 8 threads running at 2.4 ghz that process shy of 28 millions request per day in average. It average 350~ish queries per seconds but in reality during peak hours i reach more like 4k/seconds. they are very small and quick queries but still it takes lots of CPU.

 

Ram will depend on peak queries. You need to know your user basis and estimate the peak hours and know how much queries and type are being uses. You can force call these functions and monitor the server RAM and see how much you peak at.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×