Question

I have a Spring Application which is running on Apache Tomcat 7 and is fully providing REST based services. I have around 1 Million people who would be using it across the globe. My question is that is there any standard way for calculating the number of Processors required as well the RAM required for such a site. Since I have the most at my disposal but I would like to order the product wisely. I am seriously looking ahead for a formula or something that can make me do such an estimate. Please point me to this.

Or Please point me to the various constraints that should be taken into account in order to get such an infrastructure up and running. I would like you to point the requirements for

  1. webserver with apache running
  2. app server with Tomcat running
  3. database server with Redis,postgres and mongodb running.

Thanks a ton.

Était-ce utile?

La solution

I'll try and list a few constraints that I can think of, but there might be more:

webserver with apache running

Take a look at the number of file handles that are used (in case apache serves static content like css, javascript or images).

Additionally, the number of http connections might be a constraint (normally one per concurrent user).

Another constraint might be the number ajp worker threads that pass requests to tomcat.

Memory constraints requirements might not be that huge but that depends on what your apache does.

app server with Tomcat running

Here the size of the sessions would be a constraint. Note that depending on the session timeout, the number of concurrent sessions might be much higher that the number of concurrent users (not all need to do concurrent requests, but the sessions need memory nevertheless).

Additionally the number of threads available for service execution would be a constraint. The faster your services respond, the fewer threads are blocked and thus fewer would be needed.

database server with Redis,postgres and mongodb running.

For the database there are at least two constraints: the number of connections (at least one is needed per request with db access) and the memory for query caching (the more memory, the more query results may be cached, making responses faster).

Overall

For a system that expects 5000 - 10000 concurrent users you might want to look into clustering and load balancing. This would allow you to adjust on a ondemand basis (if your resources are being used up you can add another node, if most resources are never needed you can remove nodes) and would have the additional benefit of higher reliability (if one node is down the system might be slower, but it would still be running).

In order to profile your system you might want and simulate a number of concurrent accesses and monitor the key parameters (file handles, memory usage, threads used, database connections, http connections etc.). Start with a small number of users (e.g. 10), then increase steadily (e.g. to 100, then 1000 etc.). When access times drop below a certain (self defined) limit, find the bottleneck(s), provide more resources and try again. Eventually you'll find some trend (e.g. 1GB in accumulated session size per 500 users) which would allow you to do a rough estimate for higher numbers of concurrent users.

For simulating concurrent users have a look at Apache JMeter

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top