Im asking this question just to make sure or get some idea how much the server can take or when it going to fail, i have an Amazon EC2 instance with 8 GB RAM AND 2 VCPU,and it run some php script that only return json response no media file or any other type of data on the server ,, only have mysql database on it ,, each request to server return 16KB to 20KB from mysql the query i used it not that complex and it not that easy it fairly medium ,,let assume that the response size is 20KB with unlimited bandwidth , my question how many http request that server could handle i don't want an accurate answer ,, just approximation so i can get an idea about how much one instant could handle
2 Answers
Impossible to tell you even a guess. It depends on a lot of variables. How much memory/cpu the app uses to generate the json. How optimized your sql queries are. Doing joins? Doing orders? How large is the database? How large is the table(s) you are searching.
You need to take what you have and run some benchmarking tools over it and find out yourself.
Look into something like
- 21,910
- 7
- 55
- 79
-
I was sure the answer is 42. But I might be biased. – Mircea Vutcovici Oct 15 '17 at 02:56
-
1I suppose 42 is always the correct answer – Mike Oct 15 '17 at 03:05
Even if you do load testing and micro-benchmarks this will not tell the whole story of how your application will behave.
There are so many factors, that even for a simple well known application that 99% of the time can sustain a high load, it can have some obscure operations that could froze it for minutes. E.g.:
- snapshots of the filesystem
- snapshots of the VM
- other VM on the same host
- other VM on the same storage
- other VM traffic on the same network path
- client behaviour, including attacks (think slow loris)
- how scalable is your code
- even if it can run 500 sequential request in 1 second it might have problems running 50 concurrent requests in the same amount of time
- hardware specific stuff that will make the response time to be non-linear compared to input
- data in MySQL which can grow over time and make it slower and slower.
So what is the solution? Monitoring, benchmarks of the full stack. Benchmarks with recorded/simulated data from production. It is a process.
I recommend to read: How do you do load testing and capacity planning for web sites?
- 16,706
- 4
- 52
- 80