Performance Optimization of Teaching Web Application based SSH Framework



Similar documents
STREAMEZZO RICH MEDIA SERVER

Apache and Tomcat Clustering Configuration Table of Contents

Addressing Application Layer Attacks with Mod Security

Configuring multiple Tomcat instances with a single Apache Load Balancer

SpagoBI Tomcat Clustering Using mod_jk and httpd on Centos - In-Memory Session Replication.

Xpert.ivy 4.2. Server Guide

Apache Jakarta Tomcat

Dataworks System Services Guide

Infor Web UI High Availability Deployment

Design Approaches of Web Application with Efficient Performance in JAVA

Running multiple Tomcat versions on the same host

Research Article. ISSN (Print) *Corresponding author Lili Wang

DeskNow. Ventia Pty. Ltd. Advanced setup. Version : 3.2 Date : 4 January 2007

1. Configuring Apache2 Load Balancer with failover mechanism

JMETER - MONITOR TEST PLAN

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

Apache Tomcat ISAPI Redirector and Canto Cumulus WPP

WHITE PAPER. Domo Advanced Architecture

NGASI Shared-Runtime Manager Administration and User Guide WebAppShowcase DBA NGASI

Install guide for Websphere 7.0

Installation Guide for contineo

Apache Tomcat & Reverse Proxies

mod_cluster A new httpd-based load balancer Brian Stansberry JBoss, a division of Red Hat

Install & Configure Apache with PHP, JSP and MySQL on Windows XP Pro

Intro to Load-Balancing Tomcat with httpd and mod_jk

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL

CentOS Linux 5.2 and Apache 2.2 vs. Microsoft Windows Web Server 2008 and IIS 7.0 when Serving Static and PHP Content

Silk Central Installation Help

NetIQ Access Manager 4.1

AklaBox. The Ultimate Document Platform for your Cloud Infrastructure. Installation Guideline

VERSION 9.02 INSTALLATION GUIDE.

Clustering a Grails Application for Scalability and Availability

Building native mobile apps for Digital Factory

Customer Bank Account Management System Technical Specification Document

Installing Rails 2.3 Under CentOS/RHEL 5 and Apache 2.2

Enterprise Knowledge Platform 5.6

TG Web. Technical FAQ

LICENSE4J AUTO LICENSE GENERATION AND ACTIVATION SERVER USER GUIDE

Open Source Content Management System for content development: a comparative study

CatDV Pro Workgroup Serve r

Integrating Apache Web Server with Tomcat Application Server

How To Link Tomcat 5 with IIS 6 on Windows 2003 Server using the JK2 ajp13 connector

Web Development on the SOEN 6011 Server

JAVA/J2EE DEVELOPER RESUME

Install Apache on windows 8 Create your own server

Citrix EdgeSight Administrator s Guide. Citrix EdgeSight for Endpoints 5.3 Citrix EdgeSight for XenApp 5.3

How To Integrate IIS6 and Apache Tomcat

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

In this chapter, we lay the foundation for all our further discussions. We start

DTWMS Required Software Engineers. 1. Senior Java Programmer (3 Positions) Responsibilities:

TIBCO ActiveMatrix BusinessWorks Process Monitor Server. Installation

Performance Analysis of Web based Applications on Single and Multi Core Servers

Applications Manager Best Practices document

Forward proxy server vs reverse proxy server

Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

How to Integrate IIS with JBoss / Tomcat Under Windows XP and Linux

tibbr Now, the Information Finds You.

Enterprise Edition Scalability. ecommerce Framework Built to Scale Reading Time: 10 minutes

Integration Guide. SafeNet Authentication Service. Oracle Secure Desktop Using SAS RADIUS OTP Authentication

EMC Documentum Connector for Microsoft SharePoint

A Tool for Evaluation and Optimization of Web Application Performance

Lab 3.4.2: Managing a Web Server

ConcourseSuite 7.0. Installation, Setup, Maintenance, and Upgrade

Spectrum Technology Platform

Test Run Analysis Interpretation (AI) Made Easy with OpenLoad

Scaling Progress OpenEdge Appservers. Syed Irfan Pasha Principal QA Engineer Progress Software

Scoreboard 2.5/2.7 Installation Guide. For Apache Tomcat 7.0 On Windows 2003/2008 Server, 64-bit

Dependency Free Distributed Database Caching for Web Applications and Web Services

MapGuide Open Source. Installing and Configuring on Windows

Tomcat and MySQL, a basic high available load balanced system

An Oracle White Paper July Oracle Primavera Contract Management, Business Intelligence Publisher Edition-Sizing Guide

Lesson 7 - Website Administration

Crystal Reports for Eclipse

HP Web Jetadmin Database Connector Plug-in reference manual

FileMaker Server 11. FileMaker Server Help

JAMF Software Server Installation and Configuration Guide for Windows. Version 9.3

Running Multiple Shibboleth IdP Instances on a Single Host

This document will list the ManageEngine Applications Manager best practices

By PANKAJ SHARMA. Concepts of Server Load Balancing

StreamServe Persuasion SP5 StreamStudio

An Overview of Servlet & JSP Technology

What is Aconex Local Copy? Controlling Access to a Datastore Hardware Requirements Software Requirements Installing Aconex Local Copy Troubleshooting

Integrating SAP BusinessObjects with Hadoop. Using a multi-node Hadoop Cluster

APIS CARM NG Quick Start Guide for MS Windows

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

JAMF Software Server Installation and Configuration Guide for OS X. Version 9.2

A Monitored Student Testing Application Using Cloud Computing

IUCLID 5 Guidance and Support

5 Mistakes to Avoid on Your Drupal Website

MEGA Web Application Architecture Overview MEGA 2009 SP4

WebLogic Server: Installation and Configuration

Enterprise Application Development In Java with AJAX and ORM

JBS-102: Jboss Application Server Administration. Course Length: 4 days

FileMaker Server 10 Help

Transcription:

Performance Optimization of Teaching Web Application based SSH Framework Jianchuan Meng 1 & Changdi Shi 1 & Liming Luo 1 1. Capital Normal University, Beijing, China ABSTRACT: Because Web applications hold the feature of cross-platform and others, so more and more applications use this form, so that its development environment is gradually maturing and variety of stable and rapid development framework have also appeared, such as SSH framework, but Web application performance issue has been always a problem occurs during operation. This paper took the teaching Web application as the background, described and researched for the potential problems, proposed solutions, and finally tested it to the desire to provide reference for similar studies. KEYWORDS: SSH framework; WEB Applications; Performance Optimization 1 INTRODUCTION With the deepening integration of technology and education, educational Web applications become increasingly important. Web technology maturing and its cross-platform make it run smoothly either in a desktop computer or on a mobile device. It also reduces the cost which cross-system development brings, and therefore Web application has a great development space. With the rapid development of Web technology, some development framework with a friendly design concepts have also appeared, such as Struts, Hibernate, Spring, ibatis, JFinal, Play Framework and the like. The more popular, free and open source Java Web application framework is SSH framework, it is integration framework of Struts + Spring + Hibernate framework. SSH-based applications use a hierarchical framework design pattern, respectively, three major frameworks package Presentation layer, Logical layer and Data persistence layer, effectively reduce the coupling between the three layers, easy to transplant and modification, greatly improving the efficiency of the development. However, SSH-based Java Web application may have a lot of performance problems in the actual operation. Primary and secondary school teaching Web application, for example, its biggest feature is the need for a large number of static resources into the page, such as static pictures, animation, Longman audio and video materials, etc., in order to provide assisted learning materials for teachers to teach textbook knowledge in the classroom, while provide learning material to students out of class. So during server architecture, if the server software selected is only Tomcat application server, due to its low efficiency handling static resource, while high concurrent user access to the server, the server is prone to delaying responses, severe cases may be down. Therefore, these static resources need to a dedicated server to manage and provide the necessary services, for the non-static resources such as JSP, Servlet, Class and number of the application's configuration files need to use server software like Tomcat to manage and support to achieve the purpose of separation resources from Static to dynamic, to improve server response time and the user experience. Another problem is the data cache. Caching technology can effectively improve server response time. Li Zhihui (2013) said, "the first law of site performance optimization: Optimizing consider using caching to optimize performance," that is, when the site comes to performance bottlenecks, the first solution is to use cache. In the more complex software design, the cache is almost everywhere, and a large site architecture have used cache in many ways. In Primary and Secondary Web applications, its audience as students need more shorter response time than adults, so it need to use the appropriate caching techniques. In the database connection, the two sides were connected applications and databases, if not configure a database connection, it is easy to take up a lot of resources while concurrent fall in, resulting in a request response delay or failure, so it is necessary for both sides to configure the database connection pool. This study took English intelligent E-Book System (hereinafter referred to as "ebook System") as the project background, for the issues raised above, improve the application and server, to improve the performance of the server.

2 PROJECT BACKGROUND EBook system as the project background of this paper is committed to providing students 1: 1 personalized digital classroom learning environment, but also to meeting the needs of independent learning after school. It is a self-learning tool software for primary which is able to tailor a personalized English learning resource, with resource miniaturization, Personalized Learning, Activities related resources and social activities and other characteristics. As the system for primary audience, it places on the display page a lot of pictures, text and other static resources to replace the text display. In the system all learning resources are uploaded and attached by teachers and other teachers and students can share the resources, which have been constructed rich online English learning environment. 3 FACTORS AND OPTIMIZATION MEASURES 3.1 The main affect factors of Web application performance (1)Because the system implants a lot of static resources, such as still pictures, video resources, audio resources, Doc documents, PDF documents, PPT documents, etc., so the movement of resources separation can effectively reduce server response time. (2)Since J2EE is a multilayer distributed architecture, so a lot of data communication between levels is a major factor affecting performance. (3)Frequently establishing and closing connections can greatly reduce the performance of the system, so the use of connections often become the bottleneck in system performance. 3.2 Optimization measures 3.2.1 Separation between Static and dynamic resource The separation is a thinking for server framework, the core idea is to deploy static resources (Html, CSS, Javascript, images, videos, documents, etc.) and dynamic resource (Jsp, Servlet, Class, application configuration files, etc.) to different software on the server, when a user sends a request, the server judge resource type based on URL requested, then the task is distributed to the corresponding server software or program to perform a series of operations, the final response to the client. The separation contributes to the rational use of server resources, its configuration requires two types of software: Http servers and application servers. As used herein, it is free and open source software: Apache Http Server and Tomcat server under the Apache Software Foundation (hereinafter referred to as "ASF"). Apache Http Server (referred to as apache) under the ASF is an open source HTTP server which can run on most computer operating systems. With fast and reliable features, it is one of the most popular HTTP server software, but also it can be used as a load balancing server software. ASF Tomcat is a free open-source Web application server, a lightweight application server software. Compared with the apache, the difference is that Tomcat is the Servlet and JSP container, which is its default mode. In addition Tomcat also has the ability to deal with static HTML pages, however, compared with apache, Tomcat has lower power processing static HTML pages and other static resources, so in a production environment, it often uses apache and Tomcat to improve the efficiency of the server response. The following describes how to configure it in the project. Firstly, install Tomcat and apache software. Download the latest version of the Tomcat software from ASF official website and correctly installed on the server, open the browser and enter http: // localhost: 8080 /, if it displays "If you're seeing this, you've successfully installed Tomcat. Congratulations! " on the page, then it proofs that Tomcat has been installed successfully. Similarly, download the latest version of apache software and install it, point your browser to http: // localhost: 81 /, if the page is displayed "It works!", then it proves apache has been successfully installed. Secondly, configure apache and Tomcat. Many characteristics of apache is achieved by compiled module, the same to connecting apache and Tomcat. So download module mod_jk.so (mod_jk is connector of apache and Tomcat, which is maintained by the ASF. In its official website you can get the source code and binary code), copy the file to the modules folder under the root directory of apache, and then configure conf / httpd.conf, load jk module, as the following code: LoadModule jk_module modules\mod_jk.so Although it is declared to load mod_jk module at server startup, but does not specify which Tomcat server(s) to connect, so it is necessary to introduce in the conf / httpd.conf the following code: JkWorkersFile "conf\workers.properties" Loading workers.properties under conf folder (code below) is to set the number of Tomcat and connecting each worker (In the apache, each Tomcat server is called a worker) configuration. worker.list = controller worker.tomcat1.port = 8009 worker.tomcat1.host = localhost worker.tomcat1.type = ajp13 worker.tomcat1.lbfactor = 1 worker.controller.type = lb worker.controller.balanced_workers = tomcat1 worker.controller.sticky_session = false worker.controller.sticky_session_force = 1 If you configure multiple workers, through the use of load balancing, when the total load in certain

circumstances, the requests are balanced to workers, which makes the number of requests per worker obtained relative to the total load to reduce. It can greatly reduce the system response time, but the focus of this study is concerned the software itself performance problems, and therefore only a worker is configured. Tomcat1 is marked corresponding Tomcat server, which is connected to a Tomcat by the specified label, so Tomcat in the corresponding configuration file% CALALINA_HOME% \ conf \ server.xml need to specify the same label, as follows: <Engine name="catalina" defaulthost="localhost" jvmroute="tomcat1" > Thirdly, we need to configure apache virtual hosts. The role of virtual host configuration tells apache server which requests to processing, as well as how to deal with and so on. According to the original directory structure, all static resources web project needed will be copied under E: \ Apache2.2 \ webroot (specific path may to set up depending on the situation). Then open the apache \ conf \ httpd.conf, add the following code in the file: <VirtualHost *:81> ServerAdmin administer@126.com DocumentRoot E:\Apache2.2\webroot <Directory "E:\Apache2.2\webroot"> Allow from all </Directory> ServerName cnu.com ServerAlias www.cnu.com DirectoryIndex index.html index.htm index.jsp index.action JkMount /*.jsp controller JkMount /*.cnu controller </VirtualHost> All requests apache server receives which takes HTTP as the transport protocol, 81 as the port number are referred to the virtual host: requests which URL extension is jsp or cnu are referred to the controller (previously configured load balancing worker) to deal with, namely dynamic resources request Tomcat server; otherwise, apache server request resources under "E \ Apache2.2 \ webroot" path, which is handled by the apache server. Then the word is over. 3.2.2 Hibernate caching mechanism Hibernate is a facing Java environment, O / R Mapping database mapping tool, in essence, it packages JDBC for database operations. It not only managers the mapping from Java classes to database tables, but also provides data query and retrieval methods, and can greatly reduce processing time used to SQL and JDBC. Hibernate provides two caching mechanism, the first one is the Session level cache or the first level cache. Hibernate Session object is the basic channel that applications to exchange data with the database, usually corresponds to a transaction. After the transaction is closed, then the Session. In applications using Hibernate, Seesion cache is required, by default, it is turned on, also not be uninstalled. The second cache is a SessionFactory cache, application-level cache or the second level cache, It contains built-in cache and external cache. The built-in caches some data SessionFactory object collection attributes contain, which is read-only. SessionFactory external cache is a configurable plug-in, by default, SessionFactory will not enable this plug-in. SessionFactory survival range is the entire project, during the data exchange, all Session instances share the same SessionFactory configuration information and data. The advantage of this configuration is to save frequently accessed and little change data in cache of a local application server when the first query, when accessing the same data again, you can directly obtain from the local cache to improve query efficiency, shorten response time, while reducing the pressure on the database server. While configuring a secondary cache helps to improve application performance, reduce database resources waste, but it needs to consider depending on the circumstances whether to use the secondary cache, and the cache can be configured to their specific cache policy for a certain persistent object. The cases suitable for use second-level cache are: (1) Data update frequency is not too high (2) Individual data is not too large (3) Non-private information The following will take ebook system for example, and configure Hibernate second level cache for Java Web system. There are many implementations of secondary cache, such as Ehcache, OSCache, JBoss Cache 1.x, JBoss Cache 2 and the secondary cache Hibernate itself to achieve. They have advantages and disadvantages (for detailed description you can refer to Hibernate Reference Documentation). With rapid lean, etc., Ehcache is a framework within a process which is written in pure Java language, which mainly caches the database data and is the default secondary cache provider of Hibernate. It is suitable for this system. First you need to import the necessary jar package under the path of WEB-INF \ lib, and then configure Ehcache profile, <diskstore path="java.io.tmpdir"/> <defaultcache maxelementsinmemory="3000" eternal="false" timetoidleseconds="120" timetoliveseconds="1200"

/> overflowtodisk="true" Explicitly declare enable Hibernate second-level cache in Hibernate configuration file hibernate.cfg.xml, the code is as follows. <property name="hibernate.cache.use_second_level_c ache">true </property> <property name="cache.provider_class"> org.hibernate.cache.ehcacheprovider</propert y> <property name="hibernate.cache.use_query_cache"> true </property> The first two <property> is the configuration of Ehcache, the third <property> is the configuration of query cache. Query caching is a query mechanism that based on the secondary cache. That is, if secondary cache opened, when the requests with the same query conditions and using the specified query method, the application server will first search data from local memory. If the query hits and the data is valid, then it returns the data directly, or from a database query, and cache to the application server. Thus, the only explicitly configure the query cache, the secondary cache can really play a role. While opening the query cache, but you did not specify the cache policy, and therefore also need to specify the cache policy in the configuration file of entity class. There are four optional caching strategy: transactional, read-write, nonstrict-read-write, read-only. Because Ehcache not support transactional cache types, it is possible to modify the cache data in ebook system, and it is strictly enforced transaction isolation, so read-write strategy is the best selection. Finally, when querying the data you need to use the query cache Query.setCacheable (true), then the secondary cache really take effect. Query query = super.createquery(hql); query.setfirstresult(0); query.setcacheable(true); List<Keyword> list = query.list(); 3.2.3 Database connection pool MySQL is a free open source relational database management system and use standard SQL language for data access. Because of its small size, high speed, low cost, reliable, mature technology and other advantages, many small and medium sites in the development process choose MySQL as the site database. MySQL currently belongs to Oracle Corporation, containing the community and commercial version. There is a database connection pool (Thread _pool) plug-in configuration in a commercial version, but in the community edition, although not have this configuration, but you can use the thread cache (Threads_cached) to cache free connections. In applications, it also tend to configure the database connection pool. The more popular database connection pool technologies are Proxool, C3p0, DBCP, but because of too much bugs DBCP connection pool hold, Hibernate officials have announced that DBCP connection pool is no longer supported, and recommend Proxool and C3p0, but the specific choice needs to be applied depending on the characteristics of the program itself. To select an appropriate database connection pool for ebook system, the author configure two connection pools, and test the efficiency of the two pools through comparing the average time by 10 tests each, a total of five times the average(table 1). As can be seen from the table, two configurations are comparable in response time. Proxool is slightly faster than C3P0, so we choose Proxool as the database connection pool of the system. Table 1 The average time of two connection pool But in the actual operation it may appear Http Status 500 errors: Could not open Hibernate Session for Transaction (already configured minimum-connection-count = 10, maximum-connection-count = 100, house-keeping-sleep-time = 5000 and autoreconnect = true). This phenomenon is a direct result of the number of connections is insufficient due to Hibernate Session can not be created. After testing, when clicking on a link, the connection application server and the database has not been turned off, then if the same client makes the same request again, application server and database server will re-establish a connection, but first requested connection is not disconnect, after a number of iterations the connection number reach the maximum database connection number, and then the error appears as described above, and therefore it needs to manually disconnect connection after the response. In proxool configuration, there is an attribute named maximum-active-time, the official described as: If the housekeeper comes across a thread that has been active for longer than this then

it will kill it So make sure you set this to a number bigger than your slowest expected response! Default is 5 minutes. In the ebook system, slowest response in all the requests also within 5s, so in proxool set the maximum-active-time = 5000 (ms), that is, after five seconds the link is broken, you can solve the problem. 4 PERFORMANCE TESTING 4.1 Static and dynamic separation test Test environment: Operating System: Windows 7 Ultimate Edition Service Pack 1 Memory: 8GB (7.84GB available) Processor: Intel Core 2 CPU Q9550 @ 2.83GHz JDK version: 1.8.0_31 Myeclipse: 10.0 Database: MySQL 5.5.20 Tomcat: 7.0.59 Apache: 2.2 HP Loadrunner: 11.00.0.0 Test procedure: Using Performance testing software Loadrunner 11.00.0.0 records test script referred to student status login operations, sets the virtual number of concurrent as 30, after running five minutes stop it. Record the number of Tomcat server threads running in the run up to 2.5 minutes both cases Tomcat and Tomcat + apache, the test results are shown in Table 2. Analysis: When only configure Tomcat, client requests are forwarded to port 8080, so you can see the number of threads which run 105. When Tomcat + apache server, because the apache configured connection port number with Tomcat is 8009, so you can see run number of threads 4, a large number of client requests for static documents are processed by the apache server, Tomcat server is significantly reduced pressure. Table 2 Application connection 4.2 Use cache test Test environment: Operating System: Windows 7 Ultimate Edition Service Pack 1 Memory: 8GB (7.84GB available) Processor: Intel Core 2 CPU Q9550 @ 2.83GHz JDK version: 1.8.0_31 Myeclipse: 10.0 Database: MySQL 5.5.20 Test procedure: Use a student status login to the system, test a fixed connection, then time and statistics it. In order to ensure the authenticity of the test results, statistics the time separately for the use of cache and not used, in each case after five times recording, each recorded average time for each 10 requests, and finally averaged. The test results are shown in Table 3. Analysis: From the test results, before the secondary cache is not configured, the total average response time of 4.85s or more. After 2-level cache, the total average response time is less than 0.85s, its query is nearly six times faster than before, which significantly improve the performance of the system. Table 3 Click on the average time of a fixed link 5 CONCLUSION Currently, the feature of Web applications cross-platform access enables application developers to develop once, run anywhere. It is easy to making server maintenance. For the users, it is widely accepted by customers that no need to install additional software access applications fast. However, during operation, sometimes there will be some problems, such as dealing with the problem of static resources, database connection problems, this time it needs for the system to specify a set of strategies to optimize performance for specific applications. This article takes ebook system as the background to optimize Web applications and makes some recommendations for improvement. REFERENCES: [1] 大 型 网 站 技 术 架 构 : 核 心 原 理 与 案 例 分 析 [M]. 电 子 工 业 出 版 社, 2013. [2] 蔡 雪 焘. (2006). Hibernate 开 发 及 整 合 应 用 大 全 /Java 开 发 利 器. 清 华 大 学 出 版 社 有 限 [3] 董 洪 杉, & 窦 延 平. (2005). 利 用 Hibernate 的 J2EE 数 据 持 久 层 的 解 决 方 案. 计 算 机 工 程, 30(B12), 17-18. [4] 磊, 计, & 里. (2006). 精 通 J2EE: Eclipse, Struts, Hibernate, Spring 整 合 应 用 案 例. 人 民 邮 电 出 版 社. [5] 赵 东 波, & 何 源 源. (2007). 基 于 Hibernate 的 效 率 查 询 的 研 究 和 应 用. 科 学 技 术 与 工 程, 7(5), 883-885. [6] HIBERNATE - Relational Persistence for Idiomatic Java [EB/OL].http://docs.jboss.org/hibernate/orm/5.0/ manual/en-us/html_single/