1 WebSphere Application Server Best Practices – Overview
这个文档描述了在开发基于servlets、JSP、JDBC、EJB等技术的WEB Application的过程中的最佳实践。下表列出了这些最佳时间,并以从1到5的等级来标识这些实践对性能的影响程度和发生的频率等。
Category | Best Practice Number and Description | Importance |
Servlets | 1. Do not store large object graphs in HttpSession | 2 |
Servlets | 2. Release HttpSessions when finished | 3 |
JSP Files | 3. Do not create HttpSessions in JSPs by default | 4 |
Servlets | 4. Minimize synchronization in Servlets | 2 |
Servlets | 5. Do not use SingleThreadModel | 5 |
All web and enterprise application components | 6. Use JDBC connection pooling | 3 |
All web and enterprise application components | 7. Reuse datasources for JDBC connections | 1 |
All web and enterprise application components | 8. Release JDBC resources when done | 3 |
Servlets | 9. Use the HttpServlet Init method to perform expensive operations that need only be done once | 4 |
All web and enterprise application components | 10. Minimize use of System.out.println
| 2 |
All web and enterprise application components | 11. Avoid String concatenation “+=”
| 1 |
Enterprise beans | 12. Access entity beans from session beans
| 3 |
Enterprise beans | 13. Reuse EJB homes | 1 |
Enterprise beans | 14. Use “Read-Only” methods where appropriate
| 3 |
Enterprise beans | 15. Reduce the transaction isolation level where appropriate
| 5 |
Enterprise beans | 16. EJBs and Servlets - same JVM - “No local copies”
| 2 |
Enterprise beans | 17. Remove stateful session beans when finished
| 2 |
Servlets | 18. Don’t use Beans.instantiate() to create new bean instances | 3 |
对于每个实践,本文档提供了以下的内容:
1、描述和简要的背景介绍。
2、一段需要避免的代码片断。
3、一段最佳时间的实例代码片断。
4、通过列举最佳实践的益处来对其性能作比较。
对于开发者而言,要想开发出高性能的WEB Application的话除了上面列出的最佳实践之外还要掌握良好的Java语言构建技巧,在Bibliography – Additional References 部分可以到找到相应的参考。