Generate Dynamic Content On Cache Server Master’s Project Aparna Yeddula Dept. of Computer Science University of Colorado at Colorado Springs.

Download Report

Transcript Generate Dynamic Content On Cache Server Master’s Project Aparna Yeddula Dept. of Computer Science University of Colorado at Colorado Springs.

Generate Dynamic Content
On Cache Server
Master’s Project
Aparna Yeddula
Dept. of Computer Science
University of Colorado at Colorado Springs
Outline of the Talk








Introduction to Dynamic Cache Server(DCS)
Related Literature
ESI (Edge Side Include) Language: Akamai’s solution to how a web
page be dynamically generated.
JSP/Servlet : use of customized JSP tags with servlets to realize
subset of ESI tags in a DCS.
Performance Comparison between ETS and JDCS (Java Dynamic
Cache Server)
Lessons Learned
Future Directions
Conclusion
11/7/2015
Maters Project Presentation
2
Introduction





Caching.
Web proxy server.
Advantage: With caching = Faster, not consume Internet bandwidth.
Disadvantage: With out caching = heavy burden on original server.
Serving Static pages:
 What data its handling and what time to refresh data.
Serving Dynamic pages:
 Distinguish dynamic portions and static, know where to find
dynamic data.
 Most cache server did not provide such services.
Solution : Akamai had proposed Edge Side Include (ESI) language,
provide solution for dynamic caching.
11/7/2015
Maters Project Presentation
3
11/7/2015
Maters Project Presentation
4
Related Literature

Active Cache: Wisconsin’s Java Cache Server.
http://www.cs.wisc.edu/~cao/papers/activecache/SECTION00100000000000000000

ETS http://www.esi.org

CDN: Akamai, Digital Island
http://www.akamai.com/index_flash.html
11/7/2015
Maters Project Presentation
5
ESI features
11/7/2015
Maters Project Presentation
6
ESI (Edge Side Include)
Language






ESI is an XML-based markup language and similar to HTML-like
markup language.
The ESI assembly model is comprised of a template containing
fragments.
The template is the container for assembly.
Each fragment is treated as separate entity.
ESI enables Web pages to be broken down into fragments of differing
cache-ability profiles. Like each fragment has its own time-to-live
(TTL) attribute.
Advantage: Reduce processing overhead on the origin server.
11/7/2015
Maters Project Presentation
7
EdgeSuite overview




Akamai EdgeSuite move web
content to the edge of the internet.
Allowing dynamic content
assembly at the edge of the
network.
Intelligent routing technology.
EdgeSuite is a complete
outsourced solution that delivers
the content.
11/7/2015
Maters Project Presentation
8
Edge side include Test Server
(ETS)

ETS is available from Akamai. http://akamai.com

The ETS server now sits in-between the origin server and the user.

Each fragment of the page needs to be retrieved from the origin
server.

The ETS server determines which parts of the page need to be
retrieved from the Origin Server.

We can install ETS on the same machine as the origin test server.
11/7/2015
Maters Project Presentation
9
ESI Example


‘<esi:include>’ tag example
For example,
<esi:include src="http://example.com/1.html" ttl=“1hr”/>
‘<esi:choose>’ tag example
For example,
<esi:choose>
<esi:when test="$(HTTP_HOST)==‘128.198.192.174'">
<esi:include src="http://www.example.com/advanced.html"/>
</esi:when>
<esi:otherwise>
<esi:include src="http://www.example.com/newuser.html"/>
</esi:otherwise>
</esi:choose>
11/7/2015
Maters Project Presentation
10
Realize DCS using JSP/Servlet

ETS free version does not implement TTL, DataBase support

We explored the use of Customized JSP Tag with servlets.

Allows us to investigate the performance issues in Dynamic
Cache Server Design.
11/7/2015
Maters Project Presentation
11
JSP (Java Server Pages) custom
tag specifications

To use the JSP custom tags, we need to define three separate
components:

JSP file.

tag library descriptor (tld).

tag handler class.
Helloworld.jsp
<%@ taglib
uri="simple-taglib.tld”
prefix="jspx" %>
<jspx:hello />
11/7/2015
simple-taglib.tld
<name>hello</name>
<tagclass>
cwp.tags.HelloWorldTag
</tagclass>
Maters Project Presentation
HelloWorldTag.java
public class HelloWorldTag
extends TagSupport {
}
12
The JSP file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<html>
<head>
<%@ taglib uri="simple-taglib.tld“ prefix="jspx" %>
<title><jspx:hello /></title>
</head>
<body>
<jspx:hello />
<jspx:hello> body tag <jspx:hello/>
11/7/2015
Maters Project Presentation
13
Cond..

<jspx:database month="<%= strmnt1%>" />

<jspx:if>
<jspx:condition><%= request.getRemoteAddr() %></jspx:condition>
<jspx:then>
<jspx:include uri="http://gallop.uccs.edu:8888/1.html" ttl="1"/>
</jspx:then>
<jspx:else>
<jspx:include uri="http://gallop.uccs.edu/2.html" ttl="1"/>
</jspx:else>
</jspx:if>








11/7/2015
Maters Project Presentation
14
Tag library descriptor file
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_1.dtd">
<taglib> <tag>
<name>hello</name>
<tagclass>cwp.tags.HelloWorldTag</tagclass>
</tag><tag>
<name> database </name>
<tagclass>cwp.tags.DataBaseTag</tagclass>
<attribute>
<name>month</name>
<required>true</required>
</attribute>
</tag> </taglib>
11/7/2015
Maters Project Presentation
15
Tag handler class
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.TagSupport;
public class HelloWorldTag extends TagSupport {
public int doStartTag() {
JspWriter out = pageContext.getOut();
out.println("<tr><td> Hello World </td></tr>");
}
public int doEndTag() {
if { return EVAL_BODY_TAG; }
else { return SKIP_BODY; }
}
}
11/7/2015
Maters Project Presentation
16
JSP Example
JSP FILE
<body>
<%@ taglib uri="include-taglib.tld" prefix="jspx" %>
<jspx:include uri="http://uccs.edu/page.html" ttl="1"/>
</body>
TLD FILE
<name>include</name> <tagclass>cwp.tags.IncludeTag</tagclass>
<attribute> <name>uri</name> <required>true</required></attribute>
<attribute> <name>ttl</name> <required>true</required></attribute>
11/7/2015
Maters Project Presentation
17
Servlet Implementation for retrieving
attributes from JSP page
public int doStartTag() throws JspException {
public void setUri (String name) {
uriName = name;
}
public void setTtl (String name) {
ttlName = name;
}
}
11/7/2015
Maters Project Presentation
18
Implementing Proxy Caching
11/7/2015
Maters Project Presentation
19
Performance Testbed Set up
Server
Server Name
Port
Configuration
ESI server
wait.uccs.edu
8080
Tomcat Server
gallop.uccs.edu
8888
Redhat Linux 7.2, DELL dual Pentium,
1GHz, 1GB RAM
Windows 2000 advanced server, DELL
dimension-4100, 933MHZ, 512MB RAM
Web Server
gallop.uccs.edu
80
Windows 2000 advanced server, DELL
dimension-4100, 933MHZ, 512MB RAM
Database
Server: MySQL
blanca.uccs.edu
3306
Redhat Linux 7.2, DELL dual Pentium,
1GHz, 1GB RAM
Client
Dynamic Cache
Server
Web Server
gallop.uccs.edu:8888
wait.uccs.edu:8080
11/7/2015
Maters Project Presentation
20
Benchmarking Results
Compare ETS and JDCS

Result - 1: ESI template page containing HTML fragments
Template page: http://gallop.uccs.edu/ayeddula/esi/esitag.html
Fragments are:
1. http://gallop.uccs.edu:8888/examples/staticpage.html ttl="5 Seconds"
2. http://gallop.uccs.edu/ayeddula/tasks.html ttl="5 Seconds"

Result - 2: JSP Custom tag page containing HTML fragments
Template page: http://gallop.uccs.edu:8888/examples/IncludeTag.jsp
Fragments in the page are:
1. http://gallop.uccs.edu:8888/examples/staticpage.html ttl="5 Seconds"
2. http://gallop.uccs.edu/ayeddula/tasks.html ttl="5 Seconds"
11/7/2015
Maters Project Presentation
21
ESI (http://gallop.uccs.edu/ayeddula/esi/esitag.html)
vs
JSP (http://gallop.uccs.edu:8888/examples/IncludeTag.jsp)
Time-to-live = '5 seconds'
80000
ESI file - Size of the packet 1501
JSP file - Size of the packet 1503
60000
50000
40000
30000
20000
10000
27
25
23
21
19
17
15
13
11
9
7
5
3
0
1
Time in MicroSeconds
70000
Request Interval
11/7/2015
Maters Project Presentation
22
Impact when increase in file size

1.
2.

1.
2.
Result - 1: ESI template page containing html fragments
Template page: http://gallop.uccs.edu/ayeddula/esi/testesi.html
Fragments are:
http://gallop.uccs.edu:8888/examples/staticpage.html ttl="5 Seconds"
http://gallop.uccs.edu/ayeddula/tasks.html ttl="5 Seconds"
Result - 2: JSP custom tag page containing html fragments
Template page: http://gallop.uccs.edu:8888/examples/IncludeTag1.jsp
Fragments are:
http://gallop.uccs.edu:8888/examples/staticpage.html ttl="5 Seconds"
http://gallop.uccs.edu/ayeddula/tasks.html ttl="5 Seconds"
11/7/2015
Maters Project Presentation
23
ESI (http://gallop.uccs.e du/aye ddula/e si/e sitag.html)
vs
JSP (http://gallop.uccs.e du:8888/e xample s/Include Tag.jsp)
Time -to-liv e = '5 se conds'
80000
ESI file - Size of the packet 1501
JSP file - Size of the packet 1503
Time in MicroSeconds
70000
60000
50000
40000
30000
20000
10000
27
25
23
21
19
17
15
13
11
9
7
5
3
1
0
Request Interval
80000
70000
60000
50000
40000
30000
20000
10000
0
11/7/2015
Maters Request
Project Presentation
Interval
27
25
23
21
19
17
15
13
11
9
7
5
3
ESI file - Size of the packet 2856
JSP file - Size of the packet 2893
1
Time in MicroSeconds
ESI (http://gallop.uccs.edu/ayeddula/esi/testesi.html)
vs
JSP (http://gallop.uccs.edu:8888/examples/IncludeTag2.jsp)
Time-to-live = '5 seconds'
24
JSP with JDBC-ODBC access
JSP custom tag page containing html fragments
Template page: http://gallop.uccs.edu:8888/examples/database.jsp
Fragments are:
JSP file include database tag
<jspx:database month="<%= strmnt1%>" />
TLD file
<name>database</name> <tagclass>cwp.DataBase</tagclass>
<attribute>
<name>month</name>
</attribute>
11/7/2015
Maters Project Presentation
25
Cont ..









import javax.servlet.jsp.tagext.TagSupport; import java.sql.*;
public class DataBase extends TagSupport {
public int doStartTag() throws JspException
{
Connection con=null; Statement stmt=null; ResultSet rs=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ayedduladb",null,null);
stmt=con.createStatement();
rs=stmt.executeQuery("select date,text from " +getMonth );
while(rs.next()) { pageContext.getOut().println( rs.getString(1) }
return SKIP_BODY; }
public void setMonth(String strMonth) { getMonth=strMonth; } }
11/7/2015
Maters Project Presentation
26
Database file
http://gallop.uccs.edu:8888/examples/database.jsp
120000
Request Serving Time
80000
60000
40000
20000
27
25
23
21
19
17
15
13
11
9
7
5
3
0
1
Time in MicroSeconds
100000
Request Interval
11/7/2015
Maters Project Presentation
27
Varying TTL implementation
JSP custom tag page containing html fragments
Template page:
http://gallop.uccs.edu:8888/examples/IncludeTag2.jsp
The test four Fragments are:
1. http://gallop.uccs.edu:8888/examples/staticpage.html
ttl="60
Seconds"
2. http://gallop.uccs.edu/ayeddula/tasks.html ttl="120 Seconds"
11/7/2015
Maters Project Presentation
28
Time in MicroSeconds
JSP file http://gallop.uccs.edu:8888/examples/IncludeTag1.jsp
uri="http://gallop.uccs.edu:8888/examples/staticpage.html" ttl="60 Seconds"
uri="http://gallop.uccs.edu/ayeddula/tasks.html" ttl="120 Seconds"
100000
90000
80000
70000
60000
50000
40000
30000
20000
10000
0
Request Serving time
0
50
100
150
200
250
Request Interval
11/7/2015
Maters Project Presentation
29
Demo









ESI pages
http://gallop.uccs.edu/ayeddula/esi/testesi.html
http://gallop.uccs.edu/ayeddula/esi/home.html
http://gallop.uccs.edu/ayeddula/esi/test.html
http://gallop.uccs.edu/ayeddula/esi/conditionesi.html
JSP Pages
http://gallop.uccs.edu:8888/examples/IncludeTag.jsp
http://gallop.uccs.edu:8888/examples/IfExample.jsp
http://gallop.uccs.edu:8888/examples/database.jsp
11/7/2015
Maters Project Presentation
30
Lessons Learned






The ETS server acts as an intermediary between the client and the
web server.
HTML code needs to reside on the Origin(main) web server NOT on
the ETS server.
Servlet can not read complete cookie data triggered through JSP tags.
It is difficult to implement Time-To-Live feature.
The url in the tag library descriptor should use ‘.’ notation instead of ‘/’
 cwp.tags.IncludeTag not cwp/tags/IncludeTag
The tag library descriptor reads only the packages but not direct class
handler.
 cwp.tags.IncludeTag not IncludeTag
11/7/2015
Maters Project Presentation
31
Future Directions

Extend ESI tags to include functions such as filtering and
merging data, transforming of fragments.

Enable displaying of fragments at different layout locations.

Explore the load balancing features of ESI.
11/7/2015
Maters Project Presentation
32
Conclusion

Designed and implemented Database tags, ESI include and
conditional tags using customized JSP tags and servlets.

Compared the performance of JDCS and that of ETS.

Generated dynamic web pages on cache servers which
conserve bandwidth.

Generated dynamic web pages on cache server with rotating
advertisement.
11/7/2015
Maters Project Presentation
33
References




[1] Active Cache: Caching Dynamic Contents on the
Web
http://www.cs.wisc.edu/~cao/papers/activecache/SECTION00100000000000000000
[3] ESI Resources
http://www.esi.org/language_spec_1-0.html
[4] “Core Servlets and Java Server Pages” by Marty
Hall
[5] “Core Web Programming” by Marty Hall and Larry
Brown
11/7/2015
Maters Project Presentation
34