Java technology applications on the Internet platform-thesis 2: application of the Communication Service Platform
Source: Internet
Author: User
[Body]
Data communication is a very active and popular application field of computer and information technology. A large communication company has developed a major support platform for its business. Here, we simply call it the "communication information service platform", which is used to carry out data services nationwide and globally. This platform is a typical Java technology applied to Internet projects.
As a technical backbone of the information technology company, I had the honor to participate in the analysis and design of the system and undertake a considerable number of Java application development tasks. Most of the software in this system is implemented by Java. In the whole system, we use Java to construct the system:
(1) The system can be divided into four layers: browser, presentation layer, middleware layer, and data layer.
(2) The presentation layer uses Java Script in Java to implement page output.
(3) The middleware layer uses Java to implement CORBA, that is, component (component), which is mainly used to encapsulate and reuse business logic.
(4) The data layer mainly refers to the implementation of databases and stored procedures.
When applying Java technology, the technologies and policies we adopt can be summarized into the following five aspects:
(1) make Java Script as simple as possible, because Java script is executed on the server in our system. The language is interpreted and executed through an interpreter, which is relatively slow, we use two HP front-end hosts to run Java scripts, but the running speed is still unsatisfactory. Therefore, we use java scripts in the design to only display the data obtained from the middleware layer, generate a dynamic page. In the initial design, the presentation layer (Java Script) undertook some business logic processing operations, resulting in unsatisfactory efficiency. Therefore, we had to minimize the amount of Java Script programs.
(2) Sharing and reuse should be considered as much as possible when using Java to implement CORBA. In this system, the original design was to allow Java to execute some database table operations when implementing component, resulting in a high load on the presentation layer. Later, when we re-designed it, we summarized all the use cases, found out the interfaces available for sharing and reuse, and encapsulated the same business logic operations into one interface. Because the execution efficiency of Java is higher than that of Java Script, the system efficiency is improved.
(3) In other projects, we have extensively used JSP and Servlet technologies in Java. Generally, the difference between the two Java technologies cannot be distinguished. To get some execution rate data of the system, we use a famous stress testing software-Load Runner to test the differences between the two technologies. The test shows that the same operation is performed using JSP and Servlet, and the test environment (the same server, pressure test workstation, and database environment) is ensured to be the same ), the obtained test data is quite different. The average execution time of a JSP operation is roughly twice that of the servlet program. In an enterprise-level application project, this may be a critical bottleneck. Therefore, we come to the conclusion that, when possible, Servlet should be used as much as possible. Of course, compared with Servlet, JSP programming is fast and easy to modify. It is acceptable for applications with low access traffic.
(4) use JDK of the same version whenever possible when using Java as the overall solution. In projects where Java is used as a programming language, almost all of them encounter the problem of "Chinese characters", that is, Java may encounter garbled characters when outputting Chinese characters without conversion. Different JDK versions have different solutions. For example, JDK v1.2.2 and JDK v1.3 have different solutions, if you place the Java program v1.2.2 in JDK v1.3, you cannot output Chinese characters smoothly. The root cause is that Java uses unicode encoding, which is different from the Chinese national standard encoding. Therefore, in this sense, the "one-time writing and running everywhere" that some people advocate may not be able to work on all occasions.
(5) When using Java, try to comply with software specifications. There is a JVM concept in Java, that is, a garbage collector is used in the Java Virtual Machine to recycle memory. However, this garbage collector brings convenience to programmers and also hides hidden risks. In program design, the spam collector cannot be executed forcibly. Therefore, developers cannot determine whether an object has been released or not, which often leads programmers to develop a bad habit of relying on automatic collection. Therefore, we require: after try and catch, the memory must be recycled explicitly (of course, only the garbage collector can be notified to recycle the garbage), which can effectively improve the system stability.
The above practical technologies and strategies are some of our practical experiences in practice. They are only for reference by developers.
Of course, when using Java as a solution, we will also encounter many headaches. These problems lead to poor concurrent execution concurrency and slow system speed. In summary, we have encountered the following main problems:
(1) using Java to implement component in CORBA is sometimes less efficient.
(2) using Java to establish a database connection is often slow.
(3) JSP programming can easily lead to the spread of system information. For example, if a hacker attacks a server running a JSP program, he can intentionally input illegal characters or exception information to the JSP program, so the program execution will be abnormal. At this time, the corresponding error message is printed on the page. Unfortunately, this information is very likely to expose the JDK version number and path information of this server. This often makes it easy for hackers to seize system vulnerabilities.
After discovering these problems, we have carefully studied and found some solutions. For example:
(1) Since the implementation of component in Java is relatively slow, we should minimize the amount of business logic executed by component. We strive to implement the operations that can be implemented in the stored procedure as much as possible. As we all know, database Stored Procedure operations are much faster than performing database operations in Java programs.
(2) Since it is slow to establish a database connection using Java, We can encapsulate the database connection into a connection pool, which can greatly improve the system efficiency. We also used "Load Runner" for stress testing. Using a connection pool is faster than not using a connection pool ~ 5 times.
(3) In order to prevent JSP and Servlet programs from printing abnormal system information. We have read a lot of JSP or servlet materials, and we have no clue. However, we can use another way of thinking, that is, starting with the Web server without starting the program, we can configure Apache so that such exception information will not be printed out, instead, it only displays a general exception description page, which can effectively solve this problem.
The vast majority of projects where we use Java as a programming language are successful. Java, as a fast and stable computer language, is widely used in Internet-based applications.
In my opinion, the application prospects of Java are very bright, and you can focus on the following aspects:
(1) It will be widely used on the Internet.
(2) Java is also useful in embedded devices. For example, in the latest Java technology, Java has already entered the mobile phone field.
(3) Most Java programs run with threads, which consume less resources and will gradually replace ASP and CGI programs. According to third-party tests, JSP programs are more than twice faster than ASP programs. Replacing ASP with JSP should be the trend of the times.
(4) Java will be widely used in wireless Internet. JAVA supports WAP, allowing you to easily develop WAP programs using Java to implement WAP applications.
(5) the seamless connection between Java and XML gives Java great advantages in data transmission and heterogeneous network communication.
Personally, I will devote myself to the application of Java in wireless internet for a long period of time, and develop more outstanding and practical projects for China's mobile communication industry.
Comments; practical experience after participating in a large project. The full text uses methods 1, 2, 3, and 4. The style of the article is monotonous and not attractive. However, the advantage of this Article is: (1) well written. (2) Select the appropriate content. (3) The listed strategies, precautions, and problems found are both realistic and credible. (This article mainly references the papers of Guangzhou Wang Haibo and others)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.