Performance Optimization of Web Applications Based on J2EE Architecture (1)

zhaozj2021-02-17  69

Foreword: This paper briefly introduces the concept and characteristics of J2EE, and describes, analyzes the performance optimization of the J2EE architecture to consider the performance optimization of the J2EE architecture, and put forward some solutions. Thoughts and methods for problems.

I. Introduction to the J2EE Architecture

J2EE is an architecture using Java 2 platform to simplify complex issues related to multi-level enterprise solutions. It uses multi-layer distributed application models, application logic is divided into components, and each application component is distributed on different machines based on their layer. Multi-layered applications provide a separate layer for different servings, and J2EE typical four-layer structure is as follows:

· Customer layer components running on the client machine

· WEB layer components running on the J2EE server

· Business logic layer components running on the J2EE server

· Enterprise Information System (Enterprise Information System) software running on the EIS server

The J2EE platform consists of a single service (SERVICES), the application interface (APIS), and protocol, which provides functional support for developing web-based multi-layer applications and proposes (JSP, Java Servlet, JDBC, EJB, RMI, JNDI) ...) and other 13 technical specifications.

Second, performance optimization

Performance is a considerable technical indicator of an application system. For design, developing a J2EE architecture-based Web site or web-based application, request / response efficiency and quality are especially important.

We often encounter such situations, when we issue a request from the client to the server, the server responds slowly when the request for accessing the database sent to the server at a certain moment. The cause of this situation is multifaceted, and if analyzed from the perspective of system programming, in order to minimize problems with low system running efficiency, then according to the technical characteristics of the J2EE architecture, the Web application based on J2EE architecture is developed. It should be technically designed for system design to optimize the design and development of applications.

Optimization of systems developed by J2EE architecture is generally for two aspects: structural optimization, database optimization structure optimization mainly includes: 1.SESSION optimization.

HTTP is a simple, stateless,-oriented protocol, which is "Connection / Request / Response / Close". Therefore, in the WEB-based processing, in order to maintain the customer state, there is a need for a method of maintaining multiple "connection / request / response / closing" transaction room user information, then the session is an easy-to-implement method. . The life cycle of the session is quite simple:

1. Create a session object

2. Store some data in the session

3. Use some way to request and use data

4. The last data is cleared

SESSION provides a better mechanism for storage status information, but because each session should take a certain system service resource, then if the web application has a large amount of access, the server resources will soon consume. Therefore, the key to optimizing the session is to first minimize the use of session, or not to save objects for a long time in the session. Then it is necessary to properly manage the session. There are two feasible methods:

One way is that after the program uses the storage object in the session, immediately actively delete and release it, so that these objects will not have a waste of system resources for a long time. Typically, you can choose to simply let the default timeout to handle temporary storage data, but doing so on the system service resources, on the other hand, it also affects the security of the system. Because if a user ends accessed with his account, leave the browser, but because some reason does not close your browser, then first he no longer needs system services, we don't want him to continue to take up system resources; I hope other people "borrow" his information enters the system. Another method is to transfer these objects stored in the session, and change to the request to generate a new identity after executing the system service each time the system is executed, and the identity and its designated data are again oriented and transmitted via Request transfer. In the next application service, pass it in turn. Request is automatically released after the request is completed, so it will not waste system resources for a long time. This approach can be considered for the process that does not need to maintain too long and high use. 2. Use the cache. If you live in Gobi Beach, there is no water source nearby, there is a river in a far away, if you are thirsty every time, you need to drink water as soon as possible, but you can't drink a glass of water. It is rushing to the river, then you need a water cylinder, you can pick a few buckets, filled the water, you can take the water directly from the water cylinder, so fast, very convenient. The cache can be a "one water cylinder", which is characterized by saving data or resources in a small place, typically saved in memory, it can be accessed throughout the application life period, for resources It is possible to use it repeatedly, so the cached access overhead is smaller than the direct access to the resource overhead. Therefore, under the premise of satisfying the wishes of the user, use the cache shared resource as much as possible to improve the performance of the entire system.

In addition, the cache also needs to be managed, so the dedicated management objects are implemented for the cache.

The next chapter focuses on optimizing speak about the database (Continued) ________________________________________________________________ These are just some of my experience in the development process, and I hope to discuss with you! Please advise!

COLABABY April 2002 Shenzhen

Email: COLABABY@clong.com OICQ: 8646328

-------------------------------------

转载请注明原文地址:https://www.9cbs.com/read-30571.html

New Post(0)