Web Hosting Java, JSP, Tomcat 6, J2EE, Servlets, Struts, Jboss
Optimization 44: Partial Sharing Optimization 43 discussed the
October 31, 2006 on 6:29 pm | In Java | Optimization 44: Partial Sharing Optimization 43 discussed the various design options for providing concurrent access to an HTML document cache. This is a particular instance of a more generic issue, that of resource pooling. When a particular resource is expensive to acquire and release, we want to spread the cost by recycling the resource many times before we let go of it (Optimizations 36, 37, and 38.) Examples of such resources you are likely to encounter are file contents, JDBC connections, threads, and more. A pooled resource may often be some user-defined object that is frequently used by your application, and pooling it may be more efficient than relying on the garbage-collection subsystem. We have already mentioned the two opposite extremes of resource sharing: the publicly shared resource pool and the thread-private instance of a resource. Between these two extremes lies the sharing middle ground of the partial-sharing resource pool. When each thread requires a single instance of a resource, you can easily eliminate contention by making it thread-private (Optimization 36). If the required number of instances cannot be determined in advance, or if the side effects of maintaining thread-private resources are too severe, you need to use a resource pool that is shared among all threads (Optimization 37). Such shared resources often become a thread contention hot spot that severely degrades performance and scalability. Threads spend significant cycles spinning idle. Partial sharing of resource pools offers a way out of a hotly contended resource pool without paying a heavy toll for side effects such as memory and cache consumption. On one extreme you can have a single resource pool serving all threads as in Figure 7.12. Figure 7.12. A single shared resource pool Our goal was to reduce thread contention by reducing the number of threads competing for a resource. Towards that goal we converted the single resource pool above into multiple identical subpools. We preferred two pools (Figure 7.13) with half the contention, or four pools with one-fourth contention, over a single pool that draws all the activity. Figure 7.13. Spreading the contention over two pools Page 172
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services
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.