Re: using cache
Dawid Joubert <[email protected]> Tue, 24 Mar 2009 21:39:53 -0000
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <FBF1D080C6B54AE391128BAB24519D1D@dawid> |
This is a multi-part message in MIME format. --===============4852179573852744490== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0027_01C9ACC9.11762850" This is a multi-part message in MIME format. ------=_NextPart_000_0027_01C9ACC9.11762850 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable One problem you may find with the built-in caching is how it determines = if a file has changed. It does this by getting the last modified time of = the file and then comparing it to the cache version. You should look into whether the modification time is cached. I do not suggest you use the built-in cache as you should use one = caching system for your entire setup. Memcached is the recommended one = as once it runs out of memory it will discard the least accessed caches. We wrote our own cache system with a preparser that used memcache. As we = had over 10 webapps servers we only needed to store one copy of the = template and that was on the memcached server. Regards Dawid Joubert ----- Original Message -----=20 From: Sam Tregar=20 To: [email protected]=20 Cc: [email protected]=20 Sent: Tuesday, March 24, 2009 8:45 PM Subject: Re: [htmltmpl] using cache 2009/3/24 <[email protected]> as a new user to html::templates i've found it pretty easy to use = but quite slow. i've turned on cache'ing but there is still no improvement and apache's log indicates that the files are being = loaded each time. so, what am i doing wrong? i've included the perl code = i use to create the template and the results shown in apache's log. this shows, i believe, that each file is being loaded each time it's referenced. it also shows another problem, that i encounter every = so often, that the file can't be found when, in fact, it's there. if i simply reload the page the file is found the 2nd time. very = confusing. Are you running mod_perl? Are you pre-loading your cache during = apache startup as described in the docs? And finally, what makes you = sure HTML::Template is the source of your performance problem? It's = actually pretty rare in my experience. -sam -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= ----- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) = are powering Web 2.0 with engaging, cross-platform capabilities. Quickly = and easily build your RIAs with Flex Builder, the Eclipse(TM)based = development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com -------------------------------------------------------------------------= ----- _______________________________________________ Html-template-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/html-template-users ------=_NextPart_000_0027_01C9ACC9.11762850 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.6000.20996" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>One problem you may find with the = built-in caching=20 is how it determines if a file has changed. It does this by getting the = last=20 modified time of the file and then comparing it to the cache=20 version.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>You should look into whether the = modification time=20 is cached.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I do not suggest you use the built-in = cache as you=20 should use one caching system for your entire setup. Memcached is the=20 recommended one as once it runs out of memory it will discard the least = accessed=20 caches.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>We wrote our own cache system with a = preparser that=20 used memcache. As we had over 10 webapps servers we only needed to store = one=20 copy of the template and that was on the memcached server.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Regards</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Dawid Joubert</FONT></DIV> <BLOCKQUOTE=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A [email protected] href=3D"mailto:[email protected]">Sam = Tregar</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = [email protected]=20 href=3D"mailto:[email protected]">[email protected]</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20 [email protected]=20 = href=3D"mailto:[email protected]">html-template-u= [email protected]</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, March 24, 2009 = 8:45=20 PM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [htmltmpl] using = cache</DIV> <DIV><BR></DIV>2009/3/24 <SPAN dir=3Dltr><<A=20 = href=3D"mailto:[email protected]">[email protected]</A>></SPAN><BR= > <DIV class=3Dgmail_quote> <BLOCKQUOTE class=3Dgmail_quote=20 style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: = rgb(204,204,204) 1px solid">as=20 a new user to html::templates i've found it pretty easy to use = but<BR>quite=20 slow. i've turned on cache'ing but there is still = no<BR>improvement=20 and apache's log indicates that the files are being loaded<BR>each = time.=20 so, what am i doing wrong? i've included the perl code = i<BR>use=20 to create the template and the results shown in apache's = log.<BR>this shows,=20 i believe, that each file is being loaded each time = it's<BR>referenced.=20 it also shows another problem, that i encounter every = so<BR>often,=20 that the file can't be found when, in fact, it's there. if = i<BR>simply=20 reload the page the file is found the 2nd time. very=20 confusing.<BR></BLOCKQUOTE> <DIV><BR>Are you running mod_perl? Are you pre-loading your = cache during=20 apache startup as described in the docs? And finally, what makes = you=20 sure HTML::Template is the source of your performance problem? = It's=20 actually pretty rare in my experience.<BR><BR>-sam<BR><BR></DIV></DIV> <P> <HR> = <P></P>------------------------------------------------------------------= ------------<BR>Apps=20 built with the Adobe(R) Flex(R) framework and Flex Builder(TM) = are<BR>powering=20 Web 2.0 with engaging, cross-platform capabilities. Quickly = and<BR>easily=20 build your RIAs with Flex Builder, the Eclipse(TM)based=20 development<BR>software that enables intelligent coding and = step-through=20 debugging.<BR>Download the free 60 day trial.=20 http://p.sf.net/sfu/www-adobe-com <P> <HR> = <P></P>_______________________________________________<BR>Html-template-u= sers=20 mailing=20 = list<BR>[email protected]<BR>https://lists.source= forge.net/lists/listinfo/html-template-users<BR></BLOCKQUOTE></BODY></HTM= L> ------=_NextPart_000_0027_01C9ACC9.11762850-- --===============4852179573852744490== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com --===============4852179573852744490== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Html-template-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/html-template-users --===============4852179573852744490==--