Generate Dynamic Content On Cache Server

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

description

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 - PowerPoint PPT Presentation

Transcript of Generate Dynamic Content On Cache Server

Page 1: Generate Dynamic Content On Cache Server

Generate Dynamic Content On Cache Server

Master’s Project

Aparna Yeddula

Dept. of Computer ScienceUniversity of Colorado at Colorado Springs

Page 2: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 2

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

Page 3: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 3

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.

Page 4: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 4

Page 5: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 5

Related Literature Active Cache: Wisconsin’s Java Cache Server.

http://www.cs.wisc.edu/~cao/papers/active-cache/SECTION00100000000000000000

ETS http://www.esi.org

CDN: Akamai, Digital Island http://www.akamai.com/index_flash.html

Page 6: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 6

ESI features

Page 7: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 7

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.

Page 8: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 8

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.

Page 9: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 9

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.

Page 10: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 10

ESI Example ‘<esi:include>’ tag example

For example, <esi:include src="http://example.com/1.html" ttl=“1hr”/>

‘<esi:choose>’ tag exampleFor 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>

Page 11: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 11

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.

Page 12: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 12

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 />

simple-taglib.tld

<name>hello</name>

<tagclass>

cwp.tags.HelloWorldTag

</tagclass>

HelloWorldTag.java

public class HelloWorldTag extends TagSupport {

}

Page 13: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 13

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/>

Page 14: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 14

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>

Page 15: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 15

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>

Page 16: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 16

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; }

} }

Page 17: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 17

JSP ExampleJSP 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>

Page 18: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 18

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;

}

}

Page 19: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 19

Implementing Proxy Caching

Page 20: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 20

Performance Testbed Set upServer Server Name Port Configuration

ESI server wait.uccs.edu 8080 Redhat Linux 7.2, DELL dual Pentium, 1GHz, 1GB RAM

Tomcat Server gallop.uccs.edu  

8888 

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

Page 21: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 21

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.jspFragments 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"

Page 22: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 22

ESI (http://gallop.uccs.edu/ayeddula/esi/esitag.html) vs

JSP (http://gallop.uccs.edu:8888/examples/IncludeTag.jsp)Time-to-live = '5 seconds'

0

10000

20000

30000

40000

50000

60000

70000

800001 3 5 7 9

11

13

15

17

19

21

23

25

27

Request Interval

Tim

e in

Mic

roS

eco

nd

s

ESI file - Size of the packet 1501JSP file - Size of the packet 1503

Page 23: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 23

Impact when increase in file size Result - 1: ESI template page containing html fragments

Template page: http://gallop.uccs.edu/ayeddula/esi/testesi.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/IncludeTag1.jsp

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"

Page 24: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 24

ESI (http://gallop.uccs.edu/ayeddula/esi/testesi.html) vs

JSP (http://gallop.uccs.edu:8888/examples/IncludeTag2.jsp)Time-to-live = '5 seconds'

0

10000

20000

30000

40000

50000

60000

70000

80000

1 3 5 7 9

11

13

15

17

19

21

23

25

27

Request Interval

Tim

e i

n M

icro

Seco

nd

s

ESI file - Size of the packet 2856JSP file - Size of the packet 2893

ESI (http://gallop.uccs.edu/ayeddula/esi/esitag.html) vs

JSP (http://gallop.uccs.edu:8888/examples/IncludeTag.jsp)Time-to-live = '5 seconds'

0

10000

20000

30000

40000

50000

60000

70000

80000

1 3 5 7 9

11

13

15

17

19

21

23

25

27

Request Interval

Tim

e in

M

icro

Seco

nd

s

ESI file - Size of the packet 1501JSP file - Size of the packet 1503

Page 25: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 25

JSP with JDBC-ODBC accessJSP custom tag page containing html fragments Template page: http://gallop.uccs.edu:8888/examples/database.jspFragments are:

JSP file include database tag <jspx:database month="<%= strmnt1%>" />

TLD file<name>database</name> <tagclass>cwp.DataBase</tagclass>

<attribute> <name>month</name> </attribute>

Page 26: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 26

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; } }

Page 27: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 27

Database filehttp://gallop.uccs.edu:8888/examples/database.jsp

0

20000

40000

60000

80000

100000

1200001 3 5 7 9

11 13 15 17 19 21 23 25 27

Request Interval

Tim

e in

Mic

roS

eco

nd

s

Request Serving Time

Page 28: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 28

Varying TTL implementationJSP 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"

Page 29: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 29

JSP file http://gallop.uccs.edu:8888/examples/IncludeTag1.jspuri="http://gallop.uccs.edu:8888/examples/staticpage.html" ttl="60 Seconds"

uri="http://gallop.uccs.edu/ayeddula/tasks.html" ttl="120 Seconds"

0100002000030000400005000060000700008000090000

100000

0 50 100 150 200 250

Request Interval

Tim

e in

Mic

roS

eco

nd

s

Request Serving time

Page 30: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 30

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

Page 31: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 31

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

Page 32: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 32

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.

Page 33: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 33

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.

Page 34: Generate Dynamic Content On Cache Server

04/19/23 Maters Project Presentation 34

References [1] Active Cache: Caching Dynamic Contents on the

Web http://www.cs.wisc.edu/~cao/papers/active-cache/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