Web Hosting Java, JSP, Tomcat 6, J2EE, Servlets, Struts, Jboss
Page 158
October 31, 2006 on 6:32 am | In Java |Optimization 39: Parallel Subtasks In order to unleash potential scalability, your application must divide its computational task into multiple subtasks that could be executed in parallel. A Web server is a good example. The computational task is to service multiple client requests as they arrive on a designated HTTP port. If your Web server is single-threaded, it can perform only one request at a time. All other requests have to queue up. To enable scalability we must break up the service task. The task of servicing all the requests on the queue is split into smaller subtasks of serving a single request. By unleashing multiple threads on the smaller subtasks, we can achieve true parallelism and scalability. Breaking up the Web service into parallel subtasks improves several performance indicators: . Response time of an individual request . Server throughput in requests per second . Server CPU utilization A Web server performs frequent blocking I/O operations. If the server consists of a single thread, no work is performed while waiting on I/O completion. A multithreaded server would just switch over to perform other tasks and keep the processors humming. The result is better throughput and higher CPU utilization. One thing that could certainly make customers unhappy is seeing their 12-way SMP server at 25 percent CPU utilization. Starting from a single-threaded application, you are likely to see throughput rise significantly as you move into multithreaded territory and increase the number of concurrent threads. As you increase the level of concurreny, you will eventually reach a point of peak throughput. If you continue to increase the number of threads beyond this “sweet spot,” you are not going to see any more gains in performance. If you keep on going, eventually throughput and other performance measures are going to plummet. Multithreading is like sugar. It could get to the point where it is just too much. Too many threads create higher contention for resources, and they eat up cache and memory space. Shortage of cache and memory space lead to costly cache misses and page faults. This could degrade performance by an order of magnitude. In Chapter 11 we develop a scalable multithreaded Java Web server. We control the number of server threads via a configuration property. We experimented with various levels of multithreading to exhibit the interaction between concurrency and throughput. We ran the Java Web server on a four-way SMP (Pentium-II, 4X200 MHz) running NT. Figure 7.8 charts the mapping from number of concurrent threads to server throughput measured by requests per second. Figure 7.8. The relationship between concurrency and throughput Page 159
Hint: If you are looking for very good and affordable webspace to host and run your tomcat hosting application check Virtualwebstudio tomcat web hosting provider
No Comments yet
Sorry, the comment form is closed at this time.
...I
just wanted to take the time to say "Thank you!" for our new webmail
system. It's great! Thanks for taking such good care of us.
Thanks
for helping me out. Just for the record, Webhostingjava.net has been a great
web host! So far your support and handling of questions has far
exceeded that of a "larger web hosting company".
I
would like to thank you for helping me with my domain...You have
shown me great patience and professionalism. I would not hesitate to
recommend you to my clients.