22
Aparna ESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Embed Size (px)

Citation preview

Page 1: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language1

ESI (Edge Side Includes) Language And Systems

By Aparna Yeddula

Page 2: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language2

Page 3: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language3

ESI Language Specification1.0

ESI is an XML-based markup language and similar to HTML-like markup language used to isolate dynamic page elements such as stock quotes and rotating banners for compilation at the "edge"

ESI is designed to leverage client tools like caches to improve end-user perceived performance. Advantage: Reduce processing overhead on the origin server

ESI allows for dynamic content assembly at the edge of the network ESI enables Web pages to be broken down into fragments of differing

cacheability profiles . Each fragment is treated as separate entity. Cached templates and fragments may be shared among multiple users ETS: ESI Test Server Sniptes: ESI includes points to HTML files, but they are not full HTML web

pages, they are just small HTML portions that fit within a web page

Page 4: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language4

Page 5: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language5

ESI

The Origin server is the existing web-server. The ETS server now sits in-between the origin server and the user.

The ETS server processes requests from the user and determines what parts of the page need to be retrieved from the Origin server.

This is determined based on caching requirements and TTL(Time To Live) settings for each ESI tag.

ETS is configured with the IP address and port for the Origin test server, thus allowing it to transparently forward requests and retrieve content, without disruption to the Origin server or web browser functions.

Although the previous diagram shows that ETS and the origin test server are running on separate machine, you can install ETS on the same machine as the origin test server.

Page 6: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language6

ESI Features

ESI tags keep dynamic content fresh with much less stress on the web server.

ESI invalidation protocol offers the methods used to invalidate (expire)data on the edge by the origin server.

Architecture spec. details the use of HTTP intermediaries to control content.

JESI tag library spec. is intended to be convenient JSP application-level interface to the ESI tags for web caching functionality. Its purpose is to help in the use of ESI tags within a JSP application.

Page 7: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language7

What is available on esi.org?

The ESI Web Page http://www.esi.org/, contains the following information:– Overview – An introduction to ESI including the technical advantages of ESI– Endorsers – Various companies that endorse ESI, such as Akamai, ATG, BEA, IBM,

Macromedia, Oracle, Silver Stream, Vignette, and others.– Specifications

ESI Language SpecificationThis specification defines ESI 1.0, the Edge Side Includes language, which allows content assembly by HTTP surrogates, by providing an in-markup XML-based language.

Edge Architecture SpecificationThis document defines the Edge Architecture, which extend the Web infrastructure through the use of HTTP surrogates - intermediaries that act on behalf of an origin server

ESI Invalidation ProtocolThis specification defines the ESI Invalidation Protocol, to allow for tight coherence between origin serves and surrogates (also know as "Reverse Proxies").

JESI Tag Library SpecificationThe Java ESI tag library is intended to be the convenient JSP application-level interface to the ESI tags for web caching functionality. Its purpose is to facilitate the use of ESI tags within a JSP application.

– News – Various news links to articles relating to, and about, ESI. And also some examples

Page 8: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language8

How many ESI tags are defined?

<esi:include src=“URI” alt=“URI” onerror=“continue”/>

Example: <esi:include src="http://example.com/1.html" alt="http://bak.example.com/2.html"

onerror="continue"/><esi:include src="http://example.com/search?query=$

(QUERY_STRING{query})"/> “include” element specifies a fragment for assembly. it does not have a closing tag. “include” statement tells ESI processors to fetch the resource specified

by the src attribute. If src not found, then fetch the “alt” alternative resource. “onerror” attribute will delete the “include” element silently.

Page 9: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language9

Cont..

<esi:inline name=“URI”fetchable=“{yes|no}” >

fragment to be stored within an ESI processor

</esi:inline> The esi processor will parse response and extract all “inline” fragments and

store them independently, under the URI specified. Some “inline” fragments are only delivered as part of an HTTP response for

another object.

Page 10: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language10

Cont..

<esi:choose> <esi:when test="$(HTTP_COOKIE{group})=='Advanced'"> <esi:include

src="http://www.example.com/advanced.html"/></esi:when><esi:when test="$(HTTP_COOKIE{group})=='Basic User'"> <esi:include

src="http://www.example.com/basic.html"/> </esi:when> <esi:otherwise> <esi:include src="http://www.example.com/new_user.html"/></esi:otherwise> </esi:choose>“choose” must have at least one “when” and optionally contain exactlyone “otherwise”

Page 11: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language11

Cont..

<esi:try>

<esi:attempt>

<esi:comment text="Include an ad"/>

<esi:include src="http://www.ex.com/ad1.html"/>

</esi:attempt>

<esi:except>

<esi:comment text="some HTML instead"/>

<a href=www.akamai.com>www.example.com</a>

</esi:except>

</esi:try>

Exception handling is provided by the “try” element

must contain exactly one instance of both an “attempt” and an “except”

Statements other than “include” and “inline” will not trigger this error.

Page 12: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language12

Cont..

<esi:comment text="..." />

Example:

<esi:comment text="animation will have a 24 hr TTL." /> The “comment” element allows developers to comment their ESI instructions. “Comments” are not evaluated by ESI Processors; they are deleted before

output. Comments that need to be visible in the output should use standard XML/HTML comment syntax.

<esi:remove> .. </esi:remove>

Example:

<esi:include src="http://www.example.com/ad.html"/> <esi:remove> <a href="http://www.example.com">www.example.com</a> </esi:remove>

discarding the remove element and its contents

Page 13: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language13

Cont..

<esi:vars> ... </esi:vars>Example:

<esi:vars> <img src="http://www.example.com/$(HTTP_COOKIE{type})/hello.gif"/ >

</esi:vars> To include an ESI variable in markup outside an ESI block

Page 14: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language14

Page 15: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language15

Cont ..

<!--esi ...-->Example: <!--esi <p> <esi:vars>Hello,

$(HTTP_COOKIE{name})!</esi:vars></p> --> This is a special construct to allow HTML marked up with ESI to

render without processing. ESI Processors will remove the start ("<!--esi") and end ("-->") when the page is processed, while still processing the contents. If the page is not processed, it will remain, becoming an HTML/XML comment tag

This assures that the ESI markup will not interfere with the rendering of the final HTML if not processed.

Page 16: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language16

Simple Code

<esi:try> Invalid markup here <esi:attempt> <esi:include ... >

This line is valid and will be processed. </esi:attempt> Invalid markup here <esi:except>

This HTML line is valid and will be processed. </esi:except> Invalid markup here </esi:try>

Page 17: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language17

Example

1. <html><head><title> An example ESI template></title><body>

2. <esi:try>

3. <esi:attempt>

4. <esi:include src="www. mysite.com/myad.html" onerror="continue" />

5. </esi:attempt>

6. <esi:except>

7. Write some HTML for the ad instead

8. </esi:except>

9. </esi:try>

10. static content

11. </body></html>

Page 18: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language18

Look at these lines to examine how ESI works

Line 2: This ESI tag specifies that the ESI processor should try to include some dynamic content. The only valid subtags, or children, of the try tag are attempt and except. Developers may notice that this closely resembles the try..catch..finally pattern of exception handling in languages such as Java and C++.

Lines 3, 4 and 5: These tags instruct the processor to attempt to fetch a fragment. Note that the tag is properly closed as per XML document rules. The onerror attribute of the include tag instructs the ESI processor to gracefully delete the error message that may be returned and to continue processing the page.

Lines 6, 7 and 8: These tags indicate what action should occur if the fragment specified in the attempt tag cannot be loaded.

Line 9: Again, the try tag is properly closed. Lines 10 and 11: Other content, including additional fragments or native markup,

may be included.

Page 19: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language19

Lessons Learned – Configuration Issues

The ETS server acts as an intermediary between the client and the web server. My original thought was that the existing web server would reference out to the ETS server for the necessary ESI tags. Actually the opposite is true, the ETS server references out to the Origin web server.

For configuration purposes this means that the HTML code needs to resided on the Origin(main) web server NOT on the ETS server

Additionally the HTML snippets referenced by the ESI include tags need to reside on the Origin web server or any other server

referenced by the ETS server.

Page 20: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language20

Setting up/testing the demo/servers

The Windows Version of the ETS server was not working. So what we have done was, we took the Linux Version of the ETS server and the “origin” server remain same(Windows2000 advanced server).

In the Linux Version - To extract the installation files from the tar file

tar xzvf ETS_1.0Beta3_Linux.tar.gz- Start install “./install” on installation make sure on port 80 there is no web server running. And set the origin server and its port number.

My installation was not successful as it was running web server on port 80. So go to the directory ./usr/local/ETS/bin at the prompt enter ./ets_config. And make sure you also make changes in the ./etc/httpd/conf/httpd.conf file.

To start the ETS server go to directory ./usr/local/ETS/bin and enter “apachectl start” and to stop enter “apachectl stop”

Page 21: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language21

ESI test 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

Page 22: AparnaESI Language 1 ESI (Edge Side Includes) Language And Systems By Aparna Yeddula

Aparna ESI Language22

References

ESI resource web page http://developer.akamai.com/cfcgi/registration.cfm ESI Web Page http://www.esi.org/ Edge Side Includes for Java http://www.akamai.com/jesi.html Emerging ESI: Lower Costs, Better Performance

http://www.networkcomputing.com/1301/1301ws12.html