[Templates] processing template chunks in parallel

[prev] [thread] [next] [Date index for 2005/03/07]

From: Cahill, Earl
Subject: [Templates] processing template chunks in parallel
Date: 23:16 on 07 Mar 2005
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C5236B.B39F750A
Content-Type: text/plain

Howdy,

 

Lately, I have been playing around with application servers, and want to
start to play around with making a page (perhaps much like the front page I
have on my.yahoo.com) could contain many chunks, each compiled in a rather
arbitrary way.  I really just want a few features to start

 

1.	the ability to call a function in a chunk (out of the box in TT)
2.	assigning priorities to handle ordering
3.	chunks with lower priority can use information from earlier chunks

 

Here's some pseudo code:

 

[% id = get_id(env.http_host), priority = 0 %]

 

[% geo = id2geo(id), priority = 1 %]

[% weather = geo2weather(geo), priority = 2 %]

[% movies = geo2movies(geo), priority = 2 %]

[% activities = weather2activities(weather), priority = 3 %]

[% reviews = movies2reviews(movies), priority = 3 %]

 

Currently, in my head the process goes something like

 

1.	TT parses the page and does all tags, except those containing a
priority
2.	I get, say, an array ref of hash refs, corresponding to the tags for
an entire page (since priorities don't necessarily match layout order), 
3.	my stuff handles the priorities and make the calls in parallel,
waiting for calls to finish appropriately
4.	I pass the array ref back to TT for interpolation, with variables
set in my code available to TT

 

Not sure if that makes any sense, but I guess the big thing is that I would
like to be able to process TT tags in parallel fashion.  Likely way ahead of
me, but if I have ten tags that each take a second, I have a ten second+
load time.  Do the same thing in parallel and I am around a second.  Like I
say, I want to play around with some potentially expensive application
server calls, and see how well I can handle them in parallel.  

 

I think it could be a very powerful tool.  Tags could essentially correspond
to application servers and be handled accordingly.  New, expensive tags just
mean more servers.  Kind of strange, but TT actually starts to model your
network architecture.

 

Wondering if the above is even possible, or if similar efforts are underway.
Just looking for thoughts.

 

Thanks,

Earl


------_=_NextPart_001_01C5236B.B39F750A
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">;

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
	{font-family:"\@MS Mincho";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:606742333;
	mso-list-type:hybrid;
	mso-list-template-ids:761807100 67698703 67698713 67698715 67698703 =
67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1
	{mso-list-id:959996329;
	mso-list-type:hybrid;
	mso-list-template-ids:-2099317604 67698703 67698713 67698715 67698703 =
67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Howdy,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Lately, I have been playing around with application =
servers,
and want to start to play around with making a page (perhaps much like =
the
front page I have on my.yahoo.com) could contain many chunks, each =
compiled in
a rather arbitrary way. &nbsp;I really just want a few features to =
start<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<ol style=3D'margin-top:0in' start=3D1 type=3D1>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo1'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>the ability to call a =
function
     in a chunk (out of the box in TT)<o:p></o:p></span></font></li>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo1'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>assigning priorities =
to handle
     ordering<o:p></o:p></span></font></li>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo1'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>chunks with lower =
priority can
     use information from earlier chunks<o:p></o:p></span></font></li>
</ol>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Here's some pseudo =
code:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[% id =3D get_id(env.http_host), priority =3D 0 %]<o:=
p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[% geo =3D id2geo(id), priority =3D 1 =
%]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[% weather =3D geo2weather(geo), priority =3D 2 =
%]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[% movies =3D geo2movies(geo), priority =3D 2 =
%]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[% activities =3D weather2activities(weather), =
priority =3D 3 %]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[% reviews =3D movies2reviews(movies), priority =3D =
3 %]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Currently, in my head the process goes something =
like<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<ol style=3D'margin-top:0in' start=3D1 type=3D1>
 <li class=3DMsoNormal style=3D'mso-list:l1 level1 lfo2'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>TT parses the page =
and does all
     tags, except those containing a =
priority<o:p></o:p></span></font></li>
 <li class=3DMsoNormal style=3D'mso-list:l1 level1 lfo2'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>I get, say, an array =
ref of
     hash refs, corresponding to the tags for an entire page (since =
priorities don't
     necessarily match layout order), <o:p></o:p></span></font></li>
 <li class=3DMsoNormal style=3D'mso-list:l1 level1 lfo2'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>my stuff handles the =
priorities
     and make the calls in parallel, waiting for calls to finish =
appropriately<o:p></o:p></span></font></li>
 <li class=3DMsoNormal style=3D'mso-list:l1 level1 lfo2'><font size=3D2 =
face=3DArial><span
     style=3D'font-size:10.0pt;font-family:Arial'>I pass the array ref =
back to TT
     for interpolation, with variables set in my code available to =
TT<o:p></o:p></span></font></li>
</ol>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Not sure if that makes any sense, but I guess the =
big thing
is that I would like to be able to process TT tags in parallel =
fashion.&nbsp; Likely
way ahead of me, but if I have ten tags that each take a second, I have =
a ten
second+ load time. &nbsp;Do the same thing in parallel and I am around =
a second.
&nbsp;Like I say, I want to play around with some potentially expensive =
application
server calls, and see how well I can handle them in parallel.&nbsp; =
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I think it could be a very powerful tool.&nbsp; Tags =
could
essentially correspond to application servers and be handled =
accordingly.&nbsp;
New, expensive tags just mean more servers.&nbsp; Kind of strange, but =
TT
actually starts to model your network =
architecture.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Wondering if the above is even possible, or if =
similar
efforts are underway. &nbsp;Just looking for =
thoughts.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Thanks,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Earl<o:p></o:p></span></font></p>

</div>

</body>

</html>

------_=_NextPart_001_01C5236B.B39F750A--

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] processing template chunks in parallel
Cahill, Earl 23:16 on 07 Mar 2005

Re: [Templates] processing template chunks in parallel
Larry Leszczynski 17:07 on 08 Mar 2005

Generated at 21:07 on 16 Mar 2005 by mariachi v0.52