340 likes | 840 Views
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
E N D
Generate Dynamic Content On Cache Server Master’s Project Aparna Yeddula Dept. of Computer ScienceUniversity 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 Maters Project Presentation
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. Maters Project Presentation
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 Maters Project Presentation
ESI features Maters Project Presentation
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. Maters Project Presentation
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. EdgeSuite overview Maters Project Presentation
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. Maters Project Presentation
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> Maters Project Presentation
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. Maters Project Presentation
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. simple-taglib.tld <name>hello</name> <tagclass> cwp.tags.HelloWorldTag </tagclass> Helloworld.jsp <%@ taglib uri="simple-taglib.tld” prefix="jspx" %> <jspx:hello /> HelloWorldTag.java public class HelloWorldTag extends TagSupport { } Maters Project Presentation
<!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/> The JSP file Maters Project Presentation
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> Maters Project Presentation
<!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> Tag library descriptor file Maters Project Presentation
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; } } } Tag handler class Maters Project Presentation
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> JSP Example Maters Project Presentation
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; } } Maters Project Presentation
Implementing Proxy Caching Maters Project Presentation
Server 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 Performance Testbed Set up Client Dynamic Cache Server Web Server gallop.uccs.edu:8888 wait.uccs.edu:8080 Maters Project Presentation
Benchmarking ResultsCompare 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" Maters Project Presentation
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: • 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" Maters Project Presentation
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> Maters Project Presentation
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; } } Maters Project Presentation
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: • http://gallop.uccs.edu:8888/examples/staticpage.html ttl="60 Seconds" • http://gallop.uccs.edu/ayeddula/tasks.html ttl="120 Seconds" Maters Project Presentation
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 Maters Project Presentation
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 Maters Project Presentation
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. Maters Project Presentation
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. Maters Project Presentation
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 Maters Project Presentation