How works the Java JVM?
I have a question form my brand new 开发者_如何学运维Java web application. In a web server, what is the biggest problem for a site that have increased your visits every day? Is memory a problem in the future? My application uses a simple J2EE, Tomcat, JPA and Hibernate.
I was a PHP developer, and for each visitor of my site, I use a little bit more memory, and in Java, how works?
Like PHP a Java web applications uses a bit of memory for each concurrent request. Thus the more concurrently running requests, the bigger the memory foot print becomes. The total required memory under certain loads depends on how fast each request is processed, because faster processing means less concurrent requests.
I also assume that a PHP web application will use very little initial memory at startup, but will use more memory for each request compared to a Java web application. The cause is that Java web application typically keeps more object preloaded and API’s like Hybernate are often configured to use database connection pooling and object caches.
It depends on how many objects you are using...in java it is usually memory issue, which is caused by a fact that you are creating DOM model of documents for example.
But if it is a simple web application, then the issue should be the fact, that there is always one servlet instance handling requests, so you wouldn't go out of memory, but it would get very slow. The threads from tomcat would have to wait until the request is processed for another one to be executed.
There are simply limits for the number of requests per second...But as I said, it is more likely then that you would get out of memory.
精彩评论