1. Project background

Our project is an independent classroom teaching aid system designed to solve the real problems of low efficiency of university classroom teaching and weak classroom teaching interaction between teachers and students. The main body of the system is divided into two interrelated software. The PC-side users of E-classes are university teachers, and the E-class APP is the Android software that serves students. The PC-side users of the "E-Class" software are university teachers. Based on the teaching needs, teachers need to inspect the attendance of students, understand the real-time learning situation of students in the classroom, and display relevant teaching materials. The users of the "E-Class" APP are students. Students use mobile phone software to interact with teachers at the right time to improve classroom efficiency and classroom interaction.
"Class E" is an independent software, and all content is self-contained. In the "E Lesson" smart phone application, teachers can log in to the system with their personal email address and password, and students can log in to the system with their student ID and password. The data needed to display the page are all read from the database and listed on the page in the form of an APP interface or a web page for users to browse. "E class" can realize main functions such as timetable query, scan QR code real-time sign-in, course detection, "I want to be a student", online course center and other auxiliary functions, such as grade point query, grade query, and other auxiliary functions, realizing new media-assisted teaching Ways to improve classroom efficiency.
The system architecture diagram is as follows:

The main functions of the student client include: join courses, sign-in, class detection, file download, class notes, personal sign-in records and other core functions, as well as university news announcement display push, automatic import and display of student class schedules, personal information, score query, etc. Function. The overview diagram of the PC terminal functions is as follows:

2. Challenges encountered

In the process of testing and use by small-scale users of this project, it was discovered that there would be OOM problems. OOM, the full name of "Out Of Memory", translated into Chinese means "out of memory", that is, java.lang.OutOfMemoryError will be thrown. Take a look at the official description: Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. When the object allocates space and the garbage collector has no space to reclaim, this error will be thrown (Note: non-exception, because this problem is serious enough to be processed by the application).

Third, the steps to solve the problem

First of all, we first troubleshoot the problem, because there are many possibilities and reasons for OOM. But nothing more than the underlying reasons are two points, one is that the allocation is less: for example, the memory available for the virtual machine itself (usually specified by the VM parameter at startup) is too small; the other is that the application uses too much and uses Endless release, wasted. This will cause memory leaks or memory overflows. (Memory leak: The memory used by the application is not released, causing the virtual machine to not use the memory again. At this time, this memory is leaked because the applicant does not use it and cannot be allocated by the virtual machine to others. Memory overflow: The requested memory exceeds the memory size that the JVM can provide, at this time it is called an overflow.)
Commonly used tools are:

1) mat: eclipse memory analyzer, a memory analysis tool based on eclipse RCP. For more information, please refer to: http://www.eclipse.org/mat/, recommended. 2) jhat: the java heap analyze tool that comes with the JDK, which can display the objects in the heap in the form of html, including the number and size of the objects, and supports the object query language OQL. After analyzing related applications, you can Access the analysis results through http://localhost:7000. It is not recommended to use, because in the actual investigation process, in the production environment 16192219ca0086 first, and then pulled to your own development machine for analysis, so it is better to use advanced analysis tools such as the previous mat to be efficient.
After several rounds of testing and investigation, it was first discovered that the -Xmx parameter was too low, and some problems were solved after increasing it. Later, it was found that there were some problems with the database query logic, and all the results of the database were queried at one time without limiting the number of results. Therefore, when the amount of information in the tested database is too large, OOM problems will also occur, so we try to optimize the database query mechanism from the logical level, thereby reducing the occurrence of OOM problems at a higher level.
The discovery of potential problems in the software has strengthened our awareness of monitoring and maintenance. After all, testing can only solve some and a small number of very obvious problems, but in the actual online process, the sudden outbreak of problems may be devastating. So we decided to improve the monitoring system. Only in this way can we better serve users, find problems as soon as possible, and solve problems such as adaptability, user experience, traffic usage, and stability. We investigated several commonly used user feedback platforms 1) Meicha, developed based on HTML5, only needs to be opened in a browser that supports H5 on IOS/Android, without installing any software programs, code implantation, one step in place, simplifying communication Process.
2) Udesk: supports the three platforms of Android, IOS and APIcloud, and can perform statistical analysis on the data feedback from users and display the results.
3) Freshdesk, a website dedicated to online customer service technical support for SME websites, provides online service quality and user experience for SME websites. During the investigation, we came across the U-Meng+ application performance monitoring platform U-APM by chance. The U-APM application performance monitoring platform provides real-time, reliable, and comprehensive application crash, ANR, custom exception capture capabilities, and supports multiple scenarios, Multi-channel intelligent alarm monitoring, efficiently restore the access path and business site of the crashed user, and shorten the troubleshooting time. It provides a complete closed loop from the discovery of the problem-the restoration of the problem-the solution of the problem-the acceptance. Perfectly meet our needs and expectations.

Four, project summary

Our project is ultimately positioned as "teaching assistant software suitable for ordinary university classroom teaching", aiming to improve university classroom efficiency and teaching interaction, as simple as possible at the functional level, and unified and standardized at the development level. Both the PC side and the Android side conform to the MVC software design model, and have good portability. The modules are highly decoupled and can be adapted to various types of redevelopment. However, an OOM problem occurred during the APP test, so we increased the -Xmx parameter, modified the database query logic, optimized the code structure, and improved the monitoring system to solve and optimize this problem, and the monitoring system was improved for the follow-up Problems that may occur in the future provide a double guarantee.


性能优化实践者
11 声望220 粉丝